React Native 开发报错 No bundle URL present
来源:互联网 发布:网络引擎优化 编辑:程序博客网 时间:2024/06/08 17:30
RN开发时候会遇到 模拟器正常调试;
但是真机调试的时候出现 :No bundle URL present
Make sure you’re running a packager server or have included a .jsbundle file in your application bundle
那么怎么解决呢?请往下看,大家经常用的代码 :
RN跳转的时候会用到:
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@”index.ios” fallbackResource:nil];
但是这个方法是干哈的呢?有人是这样解释的:
React Native iOS在0.29.0版本中BundleURL加载方法做了重大改变,新增了RCTBundleURLProvider单例类专门处理BundleURL,使用NSUserDefaults保存配置信息。
默认加载方式
在Debug模式下,执行react-native-xcode.sh编译脚本会自动获取当前网卡en0的IP地址,并打入App包中一个配置文件ip.txt,App运行时会读取ip文件,自动生成Developer Server URL,通过这种加载方式,我们不再需要手动去把”localhost”改成Mac的IP了,每次编译都会读取当前最新的IP。
也就是说,真机调试的时候你这个地址其实是固定的,解决的方式就是增加一个判断:debug的时候,让地址变成你电脑的IP他就可以获取到地址,就可以真机调试了:
NSURL *jsCodeLocation;
[[RCTBundleURLProvider sharedSettings] setDefaults];
#if DEBUG
[[RCTBundleURLProvider sharedSettings] setJsLocation:@”192.168.17.22”]; //此处是你调试电脑的IP,不要乱写
#endif
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@”index.ios” fallbackResource:nil];
- React Native 开发报错 No bundle URL present
- react-native run-ios 报错 No bundle url present
- react-native No bundle URL present
- React Native No bundle URL present 问题
- IOS-React-Native:No bundle URL present
- 解决:VM虚拟机中MAC系统react native项目再次执行react-native run-ios 报错,no bundle url present
- no bundle url present
- ReactNative iOS运行再次出错:No bundle URL present
- ReactNative iOS运行再次出错:No bundle URL present
- react-native报错Could not get BatchedBridge, make sure your bundle is packaged correctly
- React Native 报错 Could not get BatchedBridge, make sure your bundle is packaged correctly.
- React Native 自定义组件报错 has no propType for native prop
- react-native开发:创建项目报错:Command `npm install --save --save-exact react-native` failed.
- react-native开发:运行react-native run-ios报错--Print: Entry, ":CFBundleIdentifier", Does Not Exist
- no link present. Check cable 报错
- React Native常见报错
- React-Native 奇葩报错
- react-native报错-unrecognized
- js实现拖影效果
- greendao的一个大坑
- siri研究
- 分组
- 日期,小数,项目工具类
- React Native 开发报错 No bundle URL present
- C++多线程
- IOError: [Errno 28] No space left on device
- 深入理解正则表达式
- php 存取IP别用char(15)了,用int吧
- 数字证书及加密详解
- PHP递归实现无限极分类
- Android中TextView首行缩进
- 记录一些奇妙的bug【1】