React-Native 打包iOS HOC

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

完成后以下图:
复制代码

4.在xcode项目中引入bundle文件 一、将assets 和 index.ios.jsbundl 文件引入到xcode工.以下图:

注意: assets 目录导入工程中时,要选择 Create folder references,由于这是图片素材

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

hoc证书参考: www.jb51.net/article/101…

注意react-native

build 选择Edit Scheme时选择debug/release版本进行测试打包xcode

遇到的问题: 1. ide

解决方案:Xcode->file->WorkSpace settings...在弹出框中选择Legacy Build System,最后选择Done便可测试

二、错误2. ui

解决方案以下: 将项目/ios/build文件夹删除便可

自此发布测试包,正式包,只需修改证书就好。spa

相关文章
相关标签/搜索