react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Can't build release version of app - __fbBatchedBridge is undefined

Open ffxsam opened this issue 10 years ago • 56 comments

I've got an app ready to go live, but I'm unable to build a release version.

Steps I took:

  1. In Xcode, edited the scheme and set Build Configuration to Release and unchecked "Debug executable."
  2. In Terminal, ran react-native bundle --platform ios --dev false --entry-file index.ios.js --bundle-output ios/main.jsbundle --resetCache
  3. 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'

ffxsam avatar Feb 05 '16 03:02 ffxsam

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-native or 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!

facebook-github-bot avatar Feb 05 '16 03:02 facebook-github-bot

The strange thing is, I can build/run a release version on my physical device, but not Simulator.

ffxsam avatar Feb 05 '16 03:02 ffxsam

got this on 0.19

stereodenis avatar Feb 05 '16 07:02 stereodenis

It also happens on a totally fresh project with literally no code added.

ffxsam avatar Feb 05 '16 07:02 ffxsam

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

stereodenis avatar Feb 05 '16 07:02 stereodenis

@javache Why bundling is skipping for Simulator platform?

stereodenis avatar Feb 05 '16 08:02 stereodenis

Because on the simulator, you'll use a local packager server to serve up the bundle contents.

javache avatar Feb 05 '16 15:02 javache

@javache when I want to try bundled app on simulator — what should I do?

stereodenis avatar Feb 05 '16 15:02 stereodenis

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 avatar Feb 05 '16 15:02 javache

@javache it's a dirty hack)

stereodenis avatar Feb 05 '16 15:02 stereodenis

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 avatar Feb 05 '16 15:02 javache

@javache thanks for advice!

stereodenis avatar Feb 05 '16 15:02 stereodenis

Thanks. Commenting out that part of the script worked.

ffxsam avatar Feb 05 '16 17:02 ffxsam

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.

pedramsaleh avatar Feb 22 '16 21:02 pedramsaleh

+1 commenting out the lines as @javache pointed out worked for me as well in react 0.20.0

dorthwein avatar Feb 28 '16 22:02 dorthwein

@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 avatar Mar 01 '16 17:03 chetstone

@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"

miracle2k avatar Mar 02 '16 17:03 miracle2k

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.

gre avatar Mar 21 '16 11:03 gre

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.

joostlubach avatar Mar 21 '16 17:03 joostlubach

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.

ffxsam avatar Mar 21 '16 17:03 ffxsam