美文网首页
React-Native打包IOS安装在iPhone上

React-Native打包IOS安装在iPhone上

作者: 夢想永遠在騷動 | 来源:发表于2017-11-22 13:40 被阅读0次

    一、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

    相关文章

      网友评论

          本文标题:React-Native打包IOS安装在iPhone上

          本文链接:https://www.haomeiwen.com/subject/bvgarxtx.html