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
,然后重新编译即可
网友评论