React-Native打包IOS安装在iPhone上

一、react-native打包

1.命令行进入项目目录

执行 

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

2.将打包好的bundle下的文件拖入xcode项目目录中(和info.plist同目录);

3.将ios-》项目名-》AppDelegate.m修改

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

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

二、xcode设置

1.xcode 连接苹果手机

2.选择 Xcode > Preferences , 选中Acounts 添加AppleID账号。

3.双击 AppleID账号,点击+号,添加开发程序选项。

    IOS Development Certificates 和 macOS Development Certificate

4. 选择项目名,点击General, 选中Automatically manage siging,选择连接的苹果手机。

    Deployment Target版本选择与当前手机IOS版本要一致。

5.选择Build Settings,把如图的选项全部选择为IOS Developer

图一

6. 选中运行设备, 点击Run

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容