美文网首页
React Native 打包离线包

React Native 打包离线包

作者: mimikiy | 来源:发表于2017-02-24 18:51 被阅读0次

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

相关文章

网友评论

      本文标题:React Native 打包离线包

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