facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.59k stars 24.37k forks source link

Running Production Build on iOS (XCode) shows default screen #19083

Closed djschilling closed 6 years ago

djschilling commented 6 years ago

I want to put my react-native app on my phone without using the live reload server.

When i run react-native run-ios --configuration Release in the console it is working well. My app is shown in the simulator.

In XCode i followed the instructions provided on the react documentation to build my app for production. After doing that, every time i run the app on my phone i only get the default app that comes when you start a react-native app but not my app.

enter image description here

There seems to be something wrong with building the js bundle or using the right one but i cannot figure out what is wrong.

Environment

$ react-native info
Scanning folders for symlinks in mobile/node_modules (10ms)

Environment:
  OS: macOS High Sierra 10.13.4
  Node: 8.9.2
  Yarn: 1.3.2
  npm: 5.5.1
  Watchman: 4.9.0
  Xcode: Xcode 9.3 Build version 9E145
  Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
  react: 16.3.1 => 16.3.1
  react-native: 0.55.3 => 0.55.3
djschilling commented 6 years ago

I was able to narrow done the problem a bit.

When building with XCode there is a build step which calls the metro bundler. It calls the bundler something like this: node /Users/david/projects/churchtools/churchtoolsmobile/node_modules/react-native/local-cli/cli.js bundle ...

When i use the following command to build the jsbundle it works:

react-native bundle --entry-file index.js --platform ios --dev false --reset-cache --bundle-output foo.js --assets-dest ./ios

When i use the following command it does not work:

node /Users/david/projects/churchtools/churchtoolsmobile/node_modules/react-native/local-cli/cli.js bundle --entry-file index.js --platform ios --dev false --reset-cache --bundle-output foo.js --assets-dest ./ios

The globally installed react-native-cli is version 2.0.1. The locally installed reacy-native Version which also includes the cli is 0.55.3

So there seems to be a problem with the version of the cli that ships currently with react-native version 0.55.3.

stale[bot] commented 6 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.