打包步骤以下: 1.打开terminal终端->cd 项目更目录 2.项目根目录/ios/手动建立(bundle)文件 3.在终端输入以下命令:react
(index.ios.jsbundle能够自行修改)
react-native bundle --entry-file index.js --bundle-output ./ios/bundle/index.ios.jsbundle --platform ios --assets-dest ./ios/bundle --dev false
参考地址: https://www.jianshu.com/p/5a71437c3678
完成后以下图:
复制代码
5.修改Appdelegate中的配置代码
#if DEBUG
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
jsCodeLocation = [NSURL URLWithString:[[NSBundle mainBundle] pathForResource:@"index.ios.jsbundle" ofType:nil]];
#endif
复制代码
六、选择Xcode设置导航,配置证书;如图:ios
注意react-native
build 选择Edit Scheme时选择debug/release版本进行测试打包xcode
遇到的问题: 1. ide
解决方案:Xcode->file->WorkSpace settings...在弹出框中选择Legacy Build System,最后选择Done便可测试
二、错误2. ui
自此发布测试包,正式包,只需修改证书就好。spa