一捺典、react-native打包
1.命令行進(jìn)入項(xiàng)目目錄
執(zhí)行?
react-native bundle --entry-file ./index.js --bundle-output ./ios/bundle/index.jsbundle --platform ios --assets-dest ./ios/bundle --dev false
2.將打包好的bundle下的文件拖入xcode項(xiàng)目目錄中(和info.plist同目錄)顾患;
3.將ios-》項(xiàng)目名-》AppDelegate.m修改
/*jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];*/
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"index" withExtension:@"jsbundle"];
二阵具、xcode設(shè)置
1.xcode 連接蘋(píng)果手機(jī)
2.選擇 Xcode > Preferences 砸狞, 選中Acounts 添加AppleID賬號(hào)梁只。
3.雙擊 AppleID賬號(hào)绝淡,點(diǎn)擊+號(hào)昌抠,添加開(kāi)發(fā)程序選項(xiàng)睬罗。
????IOS Development Certificates 和 macOS Development Certificate
4. 選擇項(xiàng)目名,點(diǎn)擊General轨功, 選中Automatically manage siging,選擇連接的蘋(píng)果手機(jī)容达。
? ? Deployment Target版本選擇與當(dāng)前手機(jī)IOS版本要一致古涧。
5.選擇Build Settings,把如圖的選項(xiàng)全部選擇為IOS Developer
6. 選中運(yùn)行設(shè)備花盐, 點(diǎn)擊Run