1.生成bundle文件
cd到工程目录下,执行命令行代码: react-native bundle --entry-file index.ios.js --bundle-output ios/main.jsbundle --platform ios --assets-dest ./ios --dev false
2.ios项目,修改AppDelegate.m文件(使用main...jsbundle这句,注释掉localhost:8081.....这句):
// jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
jsCodeLocation = [[NSBundlemainBundle]URLForResource:@"main"withExtension:@"jsbundle”];