Adding xcframework as dependency to native modules #292
-
I've been trying to add a native xcframework library as a dependency to my iOS native modules. The iOS root application is missing the general tab in Xcode which is where one would as the framework dependency. I was able to successfully link an .aar library to my android native modules. Am I missing something while implementing in iOS or is it not supported? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 1 reply
-
I have the same question. I also managed to include a .aar on the Android side, but i can't figure it out on iOS... |
Beta Was this translation helpful? Give feedback.
-
That to the friends, to add the xcframework in the .podspec file that is in the root of the project you must add the line. s.vendored_frameworks = 'ios/exmaple.xcframework' you must keep the xcframework inside the "ios" folder that is in the root. |
Beta Was this translation helpful? Give feedback.
-
Thank you Pulnec. |
Beta Was this translation helpful? Give feedback.
-
@nicklasbring, Excellent, can you leave an example here, of how you did it? |
Beta Was this translation helpful? Give feedback.
-
@nicklasbring @pulnec Did anyone of you manage to solve this? I get as far as the Native Module recognizing the xcframework. The example app can import the xcframework just fine when adding as embedded binary, but using the native module from the example gives the "Module not found" error. |
Beta Was this translation helpful? Give feedback.
-
iOSI was able to add the following to my podspec to get the native module I was working with imported: For the XCFramework: For the needed resources (in this case there were multiple language resources and I had to make sure to import only English): And I modified the source files to only import the bridge code, and the .h / .m files that weren't imported with the vendor frameworks: When I used the default AndroidUnder dependencies in the build.gradle I added the associated .aar files like so:
And then in the project's app/build.gradle I implemented the .aar files with |
Beta Was this translation helpful? Give feedback.
-
I have a similar issue but I want the developer to obtain the xcframwork (because it's under a paywall) and import it somehow for my library to use. the xcframwork is swift only. I fixed it using the following: on my example project I put the xcframwork along with a dummy podspec in Frameworks folder and then install it using the Podfile: use_react_native!(
...
)
pod 'heresdk', :path => 'Frameworks' This approach used to work and the swift files on my library also find the Error message: 2023-12-10 18:55:59.604 xcodebuild[10512:91934] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
** BUILD FAILED **
The following build commands failed:
SwiftEmitModule normal x86_64 Emitting\ module\ for\ react_native_maps_here (in target 'react-native-maps-here' from project 'Pods')
(1 failure) |
Beta Was this translation helpful? Give feedback.
iOS
I was able to add the following to my podspec to get the native module I was working with imported:
For the XCFramework:
s.vendored_frameworks = 'ios/MiSnapSDK/*.{xcframework}'
For the needed resources (in this case there were multiple language resources and I had to make sure to import only English):
s.resources = "ios/MiSnapSDK/MiSnapUX/**/*.{png,jpeg,jpg,storyboard,xib,xcassets}","ios/MiSnapSDK/MiSnapUX/UX_Resources/en.lproj/MiSnapSDKLocalizable.strings"
And I modified the source files to only import the bridge code, and the .h / .m files that weren't imported with the vendor frameworks:
s.source_files = "ios/*.{h,m,mm}","ios/MiSnapSDK/MiSnapUX/UX_Files/*.{h,m,mm}","ios/MiSnapSDK/M…