iosreact-nativeexpo

Expo Modules API with .framework File – Where to Place and How to Integrate?


I'm working with the Expo Modules API and trying to integrate a .framework file into my Expo module. However, I'm new to native development and struggling to understand the documentation.

My questions are:

  1. Where should I place the .framework file? Should it go in the modules folder or in the ios folder, which is generated after running npx expo run:ios?
  2. Where should I put the bridging header file?

I've tried both locations, but I keep running into errors like:

"Module not found"
"File not found"
"{SDKName} not found"
Does anyone have experience with this setup or know how to resolve these issues?

Any help is appreciated!

Reference: Expo Modules API – Third-Party Library


Solution

    1. Place the .framework file under modules/ios/Frameworks
    2. Update the .podspec under modules/ios to include your framework -> s.vendored_frameworks = 'Frameworks/YourFramework.framework'
    3. Additionally, add this to ensure Swift/Objective-C compatibility to your .podspec -> s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'SWIFT_COMPILATION_MODE' => 'wholemodule' }
    4. You also need to add a bridging header to the prebuilded ios app next to your modules folder. Simply open the project in Xcode and add a {Project-Name}-Brdiging-Header.h under {Project-Name}/{Project-name}
    5. Make sure to run pod install again after adding your framework to the podspec

    In my case I also experienced a weird issue with the Frameworks header files not being found explained here.

    Hopefully this helps you. I myself struggled a lot with this and spent hours trying to make it work. Really hoping expo is updating their documentation to give us a more detailed explanation.