打包步驟以下: 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