Can't build release version of app - __fbBatchedBridge is undefined
I've got an app ready to go live, but I'm unable to build a release version.
Steps I took:
- In Xcode, edited the scheme and set Build Configuration to Release and unchecked "Debug executable."
- In Terminal, ran
react-native bundle --platform ios --dev false --entry-file index.ios.js --bundle-output ios/main.jsbundle --resetCache - Set Xcode build target to Simulator (5s, iOS 9.3) and hit run.
I get the following error:
2016-02-04 18:59:17.582 [error][tid:com.facebook.React.JavaScript] Unable to execute JS call: __fbBatchedBridge is undefined
2016-02-04 18:59:17.585 SydTechEco[76215:10166934] *** Terminating app due to uncaught exception 'RCTFatalException: Unable to execute JS call: __fbBatchedBridge is undefined', reason: 'Unable to execute JS call: __fbBatchedBridge is undefined'
Hey ffxsam, thanks for reporting this issue!
React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.
- If you don't know how to do something or something is not working as you expect but not sure it's a bug, please ask on StackOverflow with the tag
react-nativeor for more real time interactions, ask on Discord in the #react-native channel. - If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
- We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!
The strange thing is, I can build/run a release version on my physical device, but not Simulator.
got this on 0.19
It also happens on a totally fresh project with literally no code added.
when I run react-native run-ios i got this
/bin/sh -c /Users/stereodenis/work/evrone/WTCCEuroSport/ios/build/Build/Intermediates/WTCCEuroSport.build/Debug-iphonesimulator/WTCCEuroSport.build/Script-00DD1BFF1BD5951E006B06BC.sh
Skipping bundling for Simulator platform
@javache Why bundling is skipping for Simulator platform?
Because on the simulator, you'll use a local packager server to serve up the bundle contents.
@javache when I want to try bundled app on simulator — what should I do?
You can uncomment these line in react-native-xcode.sh: https://github.com/facebook/react-native/blob/master/packager/react-native-xcode.sh#L15-L18 and make sure your rootview/bridge config points to the right JS file.
@javache it's a dirty hack)
Yeah, we don't use this system internally, and it's mostly aimed at making this work fast for the default use case. You can always create a copy of this script, modify it and use that copy instead in your xcode project.
@javache thanks for advice!
Thanks. Commenting out that part of the script worked.
I got this same error on 0.20.0, and it was because my Appdelegate.m file had the line for running on the simulator uncommented, and I was trying to run on a physical device. I switched back to the other line and it ran fine.
+1 commenting out the lines as @javache pointed out worked for me as well in react 0.20.0
@javache said:
You can always create a copy of this script, modify it and use that copy instead in your xcode project.
But you can't put your new script anywhere you want:
Error: Cannot find module '/Users/chet/prj/malas/firebase/local-cli/cli.js'
because the script looks for other files relative to where it's located:
REACT_NATIVE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
So your new script still has to live in the same directory in the react-native module, which is another gotcha to watch out for when upgrading react-native.
@chetstone Change that line too; I have my script in the project's ios folder, and I write:
REACT_NATIVE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/node_modules/react-native"
also fall into this and found out the script is "Skipping bundling for Simulator platform" .. I think it's wrong, you shouldn't prevent us from testing the "bundle" mode on the simulator.
I also think this is wrong. Especially since Facebook (!!) requires a working Simulator version for App Review. It makes much more sense to use Debug / Release configs as a determinator whether a bundled version should be created / used, or whether the local packager should be used.
Nice to see some other voices join in here. I still feel that, out of the box, it should not fail when using bundle mode in the simulator.