10

I'm setting up a new project using React Native like this tutorial: https://facebook.github.io/react-native/docs/getting-started.html and build iOS release but it does not work, the blank white screen showed after LaunchScreen run.

The app works if build in Debug(react-native run-ios) but does not work in Release(build release by Xcode or terminal).

react-native v0.53.0

react-native-cli v2.0.1

node v8.10.0

Xcode 9.2

blank white screen

The log show in Xcode:

2018-02-06 15:55:14.464233+0700 MyApp[306:35863] [Accessibility] ****************** Loading GAX Client Bundle **************** 2561-02-06 15:55:14.697 [error][tid:main][RCTCxxBridge.mm:423] Failed to load bundle(file:///var/containers/Bundle/Application/4FAF82CD-9EA4-4E73-800A-A2ABC9313405/MyApp.app/main.jsbundle) with error:(Error reading bundle /var/containers/Bundle/Application/4FAF82CD-9EA4-4E73-800A-A2ABC9313405/MyApp.app/main.jsbundle (null)) 2018-02-06 15:55:14.706782+0700 Shiip[306:35863] Failed to load bundle(file:///var/containers/Bundle/Application/4FAF82CD-9EA4-4E73-800A-A2ABC9313405/MyApp.app/main.jsbundle) with error:(Error reading bundle /var/containers/Bundle/Application/4FAF82CD-9EA4-4E73-800A-A2ABC9313405/MyApp.app/main.jsbundle (null))

Pranav Kasetti
  • 8,770
  • 2
  • 50
  • 71
bkit4u
  • 505
  • 2
  • 5
  • 18

3 Answers3

5

I use many node version so the Xcode not using the node version which I used in my Terminal, it's make my app build crashed. Let's do this to solved my problem

Open The Script Build Phases in Xcode: enter image description here

Now, using with the node version path exactly (use command: which node to get your node version path)

enter image description here

And my problem was solved

bkit4u
  • 505
  • 2
  • 5
  • 18
  • 3
    Thanks for the answer. How did you know it was a problem with Xcode not knowing what Node version to use? – Marklar Apr 06 '18 at 04:35
  • I am getting this path when I write which node , I am using mac "/usr/local/bin/node" Now my path becomes this export NODE_BINARY=/usr/local/bin/node../node_modules/react-native/scripts/react-native-xcode.sh But when I do this my app gets crashed. – Sayyam abbasi Sep 12 '21 at 18:38
0

In my case,

Xcode v14.1 React native 0.69.5

I found out that the error source is due to the node version which system use for running release build. credits to this answer Stack overflow

I had to add the following lines in Xcode ==> Project ==> Build phases ==> Build react native code and images

export NODE_BINARY="/Users/<UserName>/.nvm/versions/node/v14.17.0<Your_Version>/bin/node"
../node_modules/react-native/scripts/react-native-xcode.sh

change UserName and Node version in this line accordingly

enter image description here

If you need to test in release build before uploading to testflight for review

Go to Xcode ==> product ==> Scheme ==> edit scheme ==> Select Run ==> change build configuration to release enter image description here

to run a release build from terminal

you just only need to type the following command:

 npx react-native run-ios --configuration Release

If you want run your project on a real device use --device parameter:

npx react-native run-ios --configuration Release --device "Your Device Name"
-2

The reason this is happening is because debug mode runs on the chrome javascript engine where as release mode runs on the device javascript engine. Some javascript features that work on chrome don’t work on the engines that mobile devices use. Please see mdn for more information there must be some js function you’re using that is undefined and causing the white screen.

  • If some javascript features not work in mode release, it will show error. But in my case, it's not show – bkit4u Feb 06 '18 at 16:50