You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to use the locally installed SDK in react native project. Not sure if it is supported but I gave it a try with the outcome
below. Anyone's help with correcting my installation setup is much appreciated.
Error
❌ error: Filename "LinphoneWrapper.swift" used twice: '/Users/mymac/thisproject/modules/linphonern/ios/linphone-sdk/IOS_64_RELEASE/ios-arm64-simulator/liblinphone/wrappers/swift/LinphoneWrapper.swift' and '/Users/mymac/thisproject/modules/linphonern/ios/linphone-sdk/IOS_64_RELEASE/ios-arm64/liblinphone/wrappers/swift/LinphoneWrapper.swift' (in target 'Linphonern' from project 'Pods')› 1 error(s), and 4 warning(s)CommandError: Failed to build iOS project. "xcodebuild" exited with error code 65.
If I remove the duplicate file ,LinphoneWrapper.swift from one folder, it keeps finding the same
in another.
Pod::Spec.newdo |s|
s.name='Linphonern's.version='1.0.0's.summary='A sample project summary's.description='A sample project description's.author=''s.homepage='https://docs.expo.dev/modules/'s.platforms={:ios=>'15.1',:tvos=>'15.1'}s.source={git: ''}s.static_framework=trues.dependency'ExpoModulesCore'# Swift/Objective-C compatibilitys.pod_target_xcconfig={'DEFINES_MODULE'=>'YES',}s.vendored_frameworks="linphone-sdk/apple-darwin/XCFrameworks/**"s.pod_target_xcconfig={'VALID_ARCHS'=>"arm64"}s.user_target_xcconfig={'VALID_ARCHS'=>"arm64"}s.module_name='linphonesw'# name of the swift packages.swift_version='4.0's.source_files="linphone-sdk/apple-darwin/share/linphonesw/*.swift"s.framework='linphone','belle-sip','bctoolbox's.source_files="**/*.{h,m,mm,swift,hpp,cpp}"end
LinphonernModule.swift
importExpoModulesCoreimportlinphonesw//trying to import locally installed linphone-sdk but failspublicclassLinephonernModule: Module{publicfuncdefinition()->ModuleDefinition{Name("Linphonern")// Define a method that initializes Core and returns its versionFunction("getCoreVersion"){()->StringinletlinphoneContext=LinePhoneSWHelper()returnlinphoneContext.coreVersion}}}// Helper class to manage Linphone Core initializationpublicclassLinePhoneSWHelper{privatevarmCore: Core!publicvarcoreVersion: String=""init(){// Initialize Linphone Core and retrieve the versiondo{trymCore=Factory.Instance.createCore(configPath: "", factoryConfigPath: "", systemContext: nil)
trymCore.start()coreVersion=Core.getVersion}catch{NSLog("Failed to initialize Linphone Core: \(error)")coreVersion="Initialization Error"}}}
App
Index.tsx
importReact,{useEffect,useState}from'react';import{Text,View,StyleSheet}from'react-native';importLinphonernfrom'../modules/linphonern';// Import the native moduleexportdefaultfunctionIndex(){const[coreVersion,setCoreVersion]=useState<string|null>(null);useEffect(()=>{// Fetch the Linphone Core version on component mountasyncfunctionfetchCoreVersion(){try{constversion=awaitLinphonern.getCoreVersion();setCoreVersion(version);}catch(error){console.error('Failed to fetch Linphone Core version:',error);setCoreVersion('Error fetching version');}}fetchCoreVersion();},[]);return(<Viewstyle={styles.container}><Textstyle={styles.text}>{coreVersion
? `Linphone Core Version: ${coreVersion}`
: 'Loading Linphone Core Version...'}</Text></View>);}conststyles=StyleSheet.create({container: {flex: 1,justifyContent: 'center',alignItems: 'center',},text: {fontSize: 16,textAlign: 'center',},});
compiling & building
npx expo prebuild --clean
npx expo run:ios
The text was updated successfully, but these errors were encountered:
tsuccar
changed the title
How to use Local SDK with react native environment with a wrapper
Can Local Linphone SDK work in react native environment ?
Dec 10, 2024
I need to use the locally installed SDK in react native project. Not sure if it is supported but I gave it a try with the outcome
below. Anyone's help with correcting my installation setup is much appreciated.
Error
If I remove the duplicate file ,LinphoneWrapper.swift from one folder, it keeps finding the same
in another.
Set Up
React Native Environment
npx create-expo-module --local linphonern
inside test react native project.inside wrapper module folder -
rootfolder/modules/linphonern/ios
Project folder
│ ── App/
│ ── modules/linphonern/ios
│ ├── linphone-sdk/
│ ├── linphonern.podspec
│ ├── linphonernModule.swift
│ ├── src/
│ └── linphonernModule.ts
|── package.json
└── tsconfig.json
App
compiling & building
npx expo prebuild --clean
npx expo run:ios
The text was updated successfully, but these errors were encountered: