ReactNativeiOS(三)开发零碎1 Fetch错误Network request failed
来源:互联网 发布:嵌入式编程入门 编辑:程序博客网 时间:2024/05/22 17:26
开发状态下,如果网络不通,或者 api 无效,都会给出一个大红屏幕,写着Network request failed
这个是开发状态的,实际release的产品不会,但还是要处理掉这些异常,红色屏幕对开发也是不友好的
对于ES6不熟,只好查资料,https://github.com/facebook/react-native/issues/973
jbhatab commented on Apr 23
Network request failed to Failed API request breaks app on Apr 23
jbhatab changed the title from burriko commented on Apr 23
Can we see your code? I haven't had any problems catching errors from network problems so far.
Here's an example using fetch().
fetch('http://example.com/stuff.json') .then(response => response.json()) .then(json => this._handleResponse(json)) .catch(error => { React.AlertIOS.alert( 'Error', 'There seems to be an issue connecting to the network.' ); });
joshbedo commented on Apr 24
Adding a catch
solved this issue for me, thanks! :)
Failed API request breaks app to [fetch] Failed API request breaks appon May 31
brentvatne changed the title from Collaborator
brentvatne commented on May 31
This should only happen in development mode, if you can reproduce with development mode disabled, please ping me and I'll reopen this issue! @jbhatab
0 0
- ReactNativeiOS(三)开发零碎1 Fetch错误Network request failed
- ReactNativeiOS(三)开发零碎4 Image 2 Base64
- ReactNativeiOS(三)开发零碎2 DatePickerIOS propType warning 4个
- ReactNativeiOS(三)开发零碎3 warning: Each child in ar array or integrator should have a unique "key" prop
- 解决react native使用fetch函数在ios9报network request failed的问题
- react native下fetch ios9报network request failed的问题
- 【问题处理】Mac上React Native的fetch请求报错Network request failed解决办法
- Network Request Failed
- RN--TypeError:Network request failed
- rn出现network request failed
- ubuntu更新错误W:Failed to fetch
- ubuntu Failed to fetch 404 错误解决
- Ubuntu “Failed to fetch”错误的解决方法
- react native fect network request failed
- React Native Network Request Failed解决方案
- make network request in mobx[failed version]
- 零碎笔记(三)
- ReactNativeiOS(一)安装
- 扣丁学堂——Json解析
- Android在ImageView控件中图片怎样铺满整个控件
- 关于STM32中RTC的校准方法
- Spring初始化数据库
- fileupload注意事项
- ReactNativeiOS(三)开发零碎1 Fetch错误Network request failed
- XML的Pull解析、SAX解析
- STM32 EXTI中断设置五步曲 (备忘)
- 1.Animation的使用 - 使用动画创建一个不同的登陆界面
- 机器学习--监督模式和非监督模式
- redis server配置文件参数说明
- 四十岁后才明白的道理,你可以现在就知道!
- Android GUI 之编辑框(EditText)与监视器
- Javascript的类和原型
This is what happens when I make a failed api request. Are failed api requests supposed to break the app like this? Is there a good way to have a fallback?