thekevinbrown/react-native-schemes-manager

Crash iOS - No bundle url present

GlisboaDev opened this issue · 8 comments

Steps to reproduce the behavior

-Updated our non-expo react native project from 0.57.3 to 0.57.5
-installed react-native-firebase and react-native-splash-screen libraries (among others, but these seems to be related)

Expected behavior

-Running the application from Xcode will pickup the bundler / start it and properly start the application

Actual behavior

-running the application via command line react-native run-ios works fine, but when running from Xcode it fails to find the bundler and crashes on startup.
Make sure you're running a packager server or have included a .jsbundle file in your application bundle. 2018-11-28 11:30:46.161150-0500 Loadboard[81354:4917348] *** Terminating app due to uncaught exception 'RCTFatalException: No bundle URL present. Make sure you're running a packager server or have included a .jsbundle file in your application bundle.', reason: 'No bundle URL present.

After debuging for a long period, I noticed if I change export NODE_BINARY=node ../node_modules/react-native-schemes-manager/lib/react-native-xcode.sh to use ../node_modules/react-native/scripts/react-native-xcode.sh instead everything works normally as expected.
On our package.json we have the following:
"xcodeSchemes": { "Debug": [ "Dev" ], "Release": [ "Beta" ], "projectDirectory": "ios", "settings": {} },
and on our build phase Bundle React Native code and images:
export DEVELOPMENT_BUILD_CONFIGURATIONS="+(Dev|Debug)" export NODE_BINARY=node ../node_modules/react-native-schemes-manager/lib/react-native-xcode.sh
Any idea why that might be happening? Let me know if any missing info

It'd be great to see if there's an updated version of react-native-xcode.sh in that version of react native. Can you diff the two files and see if you can spot the difference(s)? They should be minimal and just around detecting what a debug build is for the packager.

sdg9 commented

@thekevinbrown @GlisboaDev in this react native commit local-cli is removed but it's still referenced in this project

[ -z "$CLI_PATH" ] && export CLI_PATH="$REACT_NATIVE_DIR/local-cli/cli.js"

Update

Looks like this shouldn't matter as both
https://github.com/facebook/react-native/blob/master/local-cli/cli.js
and
https://github.com/facebook/react-native/blob/master/cli.js
exist and are identical.

That's interesting. Would it be possible to send a copy of your project or a minimal repro case so I can try to figure out what's going on?

Since I can't reproduce this, I'll have to close the issue as there's not much I can do to help. If there's a way I can contribute more productively please open a new issue and let me know.

@thekevinbrown This is still a very real issue, we've managed to find the solution for this after waisting many hours so i'll post our findings here in case anyone runs into this again.

This seems to actually be a limitation with cocoapods. When it copies your configurations over, it doesn't know if they were duplicated from release or debug so it ends up not setting any of the debug flags on these configuration on your cocoa pods project, an easy way to check this is to go to build settings on your Pods project in xcode, search for preprocessor macros, you'll see that DEBUG=1 is not set for your other debug configurations.

To fix this, you'll need to add a line similar to this under target in your Podfile:

project 'MyProject', 'Dev.Debug' => :debug, 'Stg.Debug' => :debug, 'Dev.Release' => :release, 'Stg.Release' => :release

See http://guides.cocoapods.org/syntax/podfile.html#project for more information about custom configurations

Run pod install again, everything should be great now :-)

You can verify it by checking for the flags as described earlier, hope this helps someone!

@thekevinbrown This is still a very real issue, we've managed to find the solution for this after waisting many hours so i'll post our findings here in case anyone runs into this again.

This seems to actually be a limitation with cocoapods. When it copies your configurations over, it doesn't know if they were duplicated from release or debug so it ends up not setting any of the debug flags on these configuration on your cocoa pods project, an easy way to check this is to go to build settings on your Pods project in xcode, search for preprocessor macros, you'll see that DEBUG=1 is not set for your other debug configurations.

To fix this, you'll need to add a line similar to this under target in your Podfile:

project 'MyProject', 'Dev.Debug' => :debug, 'Stg.Debug' => :debug, 'Dev.Release' => :release, 'Stg.Release' => :release

See http://guides.cocoapods.org/syntax/podfile.html#project for more information about custom configurations

Run pod install again, everything should be great now :-)

You can verify it by checking for the flags as described earlier, hope this helps someone!

Been working on this issue for around 3 days, nothing worked. This saved my rest of the days. @martintreurnicht Thanks for the help.

For anyone stumbling across this issue @martintreurnicht's solution works and should be added to the docs.

@thekevinbrown This is still a very real issue, we've managed to find the solution for this after waisting many hours so i'll post our findings here in case anyone runs into this again.

This seems to actually be a limitation with cocoapods. When it copies your configurations over, it doesn't know if they were duplicated from release or debug so it ends up not setting any of the debug flags on these configuration on your cocoa pods project, an easy way to check this is to go to build settings on your Pods project in xcode, search for preprocessor macros, you'll see that DEBUG=1 is not set for your other debug configurations.

To fix this, you'll need to add a line similar to this under target in your Podfile:

project 'MyProject', 'Dev.Debug' => :debug, 'Stg.Debug' => :debug, 'Dev.Release' => :release, 'Stg.Release' => :release

See http://guides.cocoapods.org/syntax/podfile.html#project for more information about custom configurations

Run pod install again, everything should be great now :-)

You can verify it by checking for the flags as described earlier, hope this helps someone!

This solved my 2 days worth of debugging, thank you!