React native app stuck on splash screen on device but works in simulator

后端 未结 15 2042
南笙
南笙 2021-02-01 01:27

My React Native app works in the XCode simulator with no issues, but when I run in a physical device, my iPhone, there\'s a problem. The app launches and gets stuck on the React

相关标签:
15条回答
  • 2021-02-01 01:51

    It seems that I have found the problem. According to https://facebook.github.io/react-native/docs/running-on-device, when you build and run the app on your device, your app will load js files from the packager on your computer, so you can live reload your app. That means your device has to be connected to your computer or has to be in the same wifi network as your computer. If your device can't access the packager, it will stuck on the splash screen and quit.

    To run on your device reliably, edit build schema and build release version.

    0 讨论(0)
  • 2021-02-01 01:52

    I was having the same issue.
    What I did was in Xcode go to Products -> Scheme -> Edit Scheme -> Select the Run tab -> Change the build configuration to Release ( default it was debug mode ) and run the app in the device.

    It was much faster and run it as like a native app.

    0 讨论(0)
  • 2021-02-01 01:58

    For me when I build, it was working fine in simulator however, in actual device only splash screen was coming and nothing else.

    This was because my build configuration was debug mode which is default I guess, I had to change release/build configuration from debug to release and everything work as expected.

    Upvote it if this helps :)

    0 讨论(0)
  • 2021-02-01 01:59

    All the solutions above do not work for me.

    It's really weird in my situation. The router in my company sends both 2.4G and 5.0G wifi. Only connecting to the 2.4G wifi works when debug on real device.

    0 讨论(0)
  • 2021-02-01 02:00

    Happened to me on my iOS device. I was connected to 4G, not WiFi. I connected to WiFi and it started working immediately.

    0 讨论(0)
  • 2021-02-01 02:03

    I tried disconnecting my iPhone from the Internet, the problem disappeared in later launches.

    So something is trying to do network stuff and causing the delay. It's a quick fix, but will do until we find the specific culprit.

    0 讨论(0)
提交回复
热议问题