React Native using pre-bundled file on device, even if DEV-mode
In react native 0.40.0, React native try to guess bundle location by itself. Please see if following points can help:
Make sure your AppDelegate.m have this line:
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]
;Check your device and your Xcode mac is running on same wifi. Internally for IOS, react native try to guess ip by itself.
Try running app first through command line, so dev packager server is running and then run app through xcode in your device.
so your problem is here:
Change code in your AppDelegate.m:
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; // comment this linejsCodeLocation = [NSURL URLWithString:@"http://xxx.xxx.x.xx:8081/index.ios.bundle?platform=ios&dev=true"]; //uncomment this line
Cheers:)
As i have faced same problem and above points didn't work for me. i got it worked by doing these steps.
- Go to xcode-> your project-> info.plist
- In "App Transport Security settings" make "Allow Arbitrary Loads" Yes.
it should fix this issue.