升级到RN 0.29.1后,我的AppDelegate.m文件中没有URL,我可以说dev = false ...是否有一种明显的方法可以关闭我失踪的开发模式?
答案 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代码后,我发现了这一点:
如果您使用其中的IP地址向您的XCode项目添加ip.txt
文件,它将使用它来确定从哪里获取index.ios
(默认情况下不会localhost
})
dev=true
(在AppDelegate.m中调用setDefaults
时)
您可以通过设置enableDev
答案 2 :(得分:0)
修改您的node_modules/react-native/packager/react-native-xcode.sh
文件并移除xip.io
在某些地方(如中国),xip.io服务不起作用