在iOS中没有开发模式的React Native 0.29+?

时间:2016-07-15 22:34:23

标签: react-native

升级到RN 0.29.1后,我的AppDelegate.m文件中没有URL,我可以说dev = false ...是否有一种明显的方法可以关闭我失踪的开发模式?

3 个答案:

答案 0 :(得分:2)

似乎facebook已经更新了有关如何使用新RCTBundleURLProvider的文档。现在我刚刚在旧版URLWithString中添加了以前的版本,它运行得很好:

添加:

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

评论:

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

答案 1 :(得分:1)

花了一些时间查看RCTBundleUrlProvider代码后,我发现了这一点:

  1. 如果您使用其中的IP地址向您的XCode项目添加ip.txt文件,它将使用它来确定从哪里获取index.ios(默认情况下不会localhost })

  2. 默认情况下启用
  3. dev=true(在AppDelegate.m中调用setDefaults时)

  4. 您可以通过设置enableDev

  5. 来更改开发

答案 2 :(得分:0)

修改您的node_modules/react-native/packager/react-native-xcode.sh文件并移除xip.io
在某些地方(如中国),xip.io服务不起作用

相关问题