Build react native app for ios release fails

486 Views Asked by At

What to achieve.
Build a react native app for ios release to be able to submit to TestFlight

What i've done.

  1. Read the documentation
  2. Change the scheme to build for release(production)
  3. Ran Product > Archive.
  4. Fails with: Missing module if switch to build for production
'React/RCTBridgeModule.h' file not found

Other things to know. This project is using Cocoapods and this is the pod file

target 'surfpass_app_rx' do

    pod 'React', :path => '../node_modules/react-native'
    pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
    pod 'react-native-webview', :path => '../node_modules/react-native-webview'
    pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

    pod 'Firebase/Core', '5.15.0'
    pod 'Fabric', '1.9.0'
    pod 'Crashlytics', '3.12.0'
    pod 'Firebase/RemoteConfig', '5.15.0'
    pod 'Firebase/Messaging', '5.15.0'
    pod 'GoogleSignIn', '4.4.0'

    target 'surfpass_app_rxTests' do
        inherit! :search_paths
        # Pods for testing
    end
end

post_install do |installer|
    installer.pods_project.targets.each do |target|
        if target.name == "React"
            target.remove_from_project
        end
    end
end

The thing here is the app builds ok for debug, but not for release. I had other targets but now I just have one single target and still fails.

1

There are 1 best solutions below

3
chancyWu On

To setup multi targets for iOS app, it's easy. Please refer to below screenshot in xcode.enter image description here expand the TARGETS, select one target then right click to duplicate. Then you get another similar target.

To solve your question, i think you likely need to solve the issue in pass_app_rx_pro target first, instead of setting up more targets. To solve please refer to React/RCTBridgeModule.h file not found