我们在本地调试的时候,可以使用index.js来开启本地服务,在局域网内运行app。

但是你会发现一旦你脱离了这个局域网就会造成app无法显示

这时候我们使用main.jsbundle

1.在React Native项目根目录下运行 npm start

2.使用curl命令生成 main.jsbundle

  

curl http://localhost:8081/index.ios.bundle -o main.jsbundle

 

在AppDelegate.m中选择使用main.jsbundle 
注释掉 关于index.js的使用

 

使用bundle jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

  

相关文章:

  • 2021-06-05
  • 2022-12-23
  • 2021-08-18
  • 2021-04-10
  • 2021-11-27
  • 2021-05-05
  • 2021-12-02
  • 2022-01-05
猜你喜欢
  • 2021-12-24
  • 2021-08-16
  • 2021-12-02
  • 2021-07-18
  • 2022-12-23
  • 2021-06-22
相关资源
相似解决方案