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
This issue could raise due to the following possibilities:
release
instead of debug
, so always expect to load main.jsbundle
, instead of running from the debug server. Change it by Product->Schema-> Edit Schema->Run-> Build Configuration: DebugCheck on Xcode log that any message like NSURLConnection finished with error - code -1004
or NSURLConnection finished with error - code -1022
.
Go to Project->Target->Build Phases-> + -> New Run Script Phase
For the below version of React Native 50:
export NODE_BINARY=node
../node_modules/react-native/packager/react-native-xcode.sh
For the higher version of React Native 50:
export NODE_BINARY=node
../node_modules/react-native/scripts/react-native-xcode.sh
NSAppTransportSecurity
NSAllowsArbitraryLoads