使用main.jsbundle在React Native中构建并运行Release Scheme

时间:2017-02-13 17:58:02

标签: xcode react-native

react-native:0.41.2

问题是我正在尝试使用我使用cli创建的main.jsbundle文件来构建和运行Release Scheme。这是我用来生成该包的命令:

node_modules/react-native/local-cli/cli.js bundle --entry-file index.ios.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios

但是,每当打包器自动启动时,单击XCode上的构建和运行按钮时,捆绑包就会正确生成!查看Products文件夹中Application的内容,我可以假设在编译应用程序中使用的bundle是从packager生成的bundle而不是我使用bundle cli命令生成的bundle。有没有办法在运行Release Scheme并使用我生成的bundle时以某种方式抑制运行的打包器?

1 个答案:

答案 0 :(得分:0)

使用xcode打开应用

在/AppDelegate.m

替换

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

jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];