我使用的是RN 0.39,它是我不久前从旧版本升级而来的。
我想使用xcodebuild在CI环境上构建我的应用程序。
首先,我运行RN-cli来获取离线包:
react-native bundle --platform ios --dev false --entry-file index.ios.js --bundle-output ios/main.jsbundle
然后,我简单地以尽可能灵活的方式运行xcodebuild:
xcodebuild -scheme MyAppScheme -configuration Release
无论是什么方案、目标或配置,这都会打开RN打包程序,这是我需要在CI环境中避免的。
最新的AppDelegate.m版本应该可以接收离线捆绑包,如果它存在的话,我想知道为什么我的不起作用。
有什么想法吗?
发布于 2017-03-12 14:05:28
我不相信最新的AppDelegate.m文件会选择捆绑的文件,因为我使用的是0.41,而它一直在加载服务器。
我有这个,它将动态地拾取服务器或本地文件,这取决于您运行的是调试构建还是发布构建。(确保您的xCode中有一个预编译的DEBUG=1标志):
#if DEBUG
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
#else
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endifhttps://stackoverflow.com/questions/42678227
复制相似问题