build package
react-native bundle --platform ios --dev false --entry-file index.ios.js --bundle-output main.jsbundle --assets-dest main.jsbundle
change AppDelegate.m
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
copy main.jsbundle file to XCode project
notice: select Create folder references
problem
- 項目如果設置了
__DV__
,打離線包的時候會出錯
Property left of AssignmentExpression expected node to be of a type ["LVal"] but instead got "BooleanLiteral"
- 如果項目沒有更改
AppDelegate
, 會報沒有設置url之類的錯誤
No script URL provided. Make sure the packager is running or you have embedded a JS bundle in your application
- 如果每次打的
Release
包都一樣,Xcode選擇Project
>Clean
,然后重新編譯即可