react-native ios打包

2017.02.16 14:29* 字数 370


Steps to release ipa file for react native


## 1. Clear caches of react.

> rm -rf $TMPDIR/react-*

## 2. Delete existed bundle file.(如果之前已经有了main.jsbundle,会删除掉,之前没有,会显示找不到)

> rm ios/main.jsbundle

## 3. Bundle main.jsbundle.

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

## 4. Release ipa file in xcode.

a) Open AppDelegate.m

注释掉: jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];

打开:   jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

c) The JS bundle will be built for dev or prod depending on your app's scheme (Debug = development build with warnings, Release = minified prod build with perf optimizations). To change the scheme navigate to Product > Scheme > Edit Scheme... in xcode and change Build Configuration between Debug and Release.

d) Confirm the 'Code Signing' settings.

e) Run Product > Archive.




步骤二:Build Settings --> PROJECT --> Other C Flags --> Other C++ --> 添加以下编译选项

-mllvm -cxf -mllvm -equ -mllvm -fcf -mllvm -chenxify-prob=10 -mllvm -falsify-loop=2 -mllvm -falsify-prob=10”

步骤三:Build Settings --> TARGETS --> 将所有Enable Bitcode选项设为No

(注意: 本步骤仅针对Xcode7.0及7.0以上版本,其他版本不需要)