Elliot
Elliot

Reputation: 13855

React Native 0.29+ without dev mode in iOS?

After upgrading to RN 0.29.1 I dont have a URL in my AppDelegate.m file where I can say dev=false... is there an obvious way to turn off dev mode that I'm missing?

Upvotes: 3

Views: 707

Answers (3)

ruandao
ruandao

Reputation: 410

edit your node_modules/react-native/packager/react-native-xcode.sh file and remove xip.io
in some place(like china), xip.io service not work

Upvotes: 0

ewindsor
ewindsor

Reputation: 885

After spending some time looking through the RCTBundleUrlProvider code, I found this out:

  1. If you add an ip.txt file to your XCode project with the IP address inside of it it will use that to determine where to get index.ios (without it defaults to localhost)

  2. dev=true is enabled by default (when setDefaults is called in AppDelegate.m)

  3. You can change dev by setting enableDev

Upvotes: 1

Brien Crean
Brien Crean

Reputation: 2648

It doesn't seem as though facebook has updated the docs on how to use the new RCTBundleURLProvider. For now I have just added back in the old URLWithString from previous versions and it works just fine:

Add:

jsCodeLocation = [NSURL URLWithString:@"http://ipaddress:8081/index.ios.bundle?platform=ios&dev=true"];

Comment:

[[RCTBundleURLProvider sharedSettings] setDefaults];
  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];

Upvotes: 2

Related Questions