ReactNativeiOS(三)开发零碎1 Fetch错误Network request failed
2015-12-27 17:38
597 查看
开发状态下,如果网络不通,或者 api 无效,都会给出一个大红屏幕,写着Network request failed
这个是开发状态的,实际release的产品不会,但还是要处理掉这些异常,红色屏幕对开发也是不友好的
对于ES6不熟,只好查资料,https://github.com/facebook/react-native/issues/973
jbhatab commented on
Apr 23
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?
jbhatab changed
the title from Network request failed to Failed API request breaks app on
Apr 23
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().
joshbedo commented on
Apr 24
Adding a
brentvatne changed
the title from Failed API request breaks app to [fetch] Failed API request breaks appon
May 31
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
这个是开发状态的,实际release的产品不会,但还是要处理掉这些异常,红色屏幕对开发也是不友好的
对于ES6不熟,只好查资料,https://github.com/facebook/react-native/issues/973
jbhatab commented on
Apr 23
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?
jbhatab changed
the title from Network request failed to Failed API request breaks app on
Apr 23
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
catchsolved this issue for me, thanks! :)
brentvatne changed
the title from Failed API request breaks app to [fetch] Failed API request breaks appon
May 31
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
相关文章推荐
- React开发项目例子
- iOS开发,入门级ReactiveCocoa教程(二)
- React-Native频繁修改IP,烦吗
- Codeforces Round #336 (Div. 2) C. Chain Reaction
- React-Native中的布局
- 运行React-Native例子UIExplorer
- Ubuntu进行 React-Native 的开发
- React Native at first sight
- 用 React 编写SVG图表
- 用 React 编写2048游戏
- Mac下安装React Native
- 在iOS6机子上运行 React-Native Demo, 自己编译 JavaScriptCore 源码,支持 iOS5.1 ,iOS 6
- react-native for android windows开发环境搭建详细记录
- ReactiveCocoa学习(一)
- 【Codeforces Round 336 (Div 2) C】【贪心 DP思维】Chain Reaction 每个灯塔位置为a[]破坏b[]范围所有灯塔 设置一个灯塔使得最多灯塔被保留
- ReactiveCocoa源码拆分解析(二)
- Codeforces Round #336 (Div. 2) C. Chain Reaction set维护dp
- 利用CocoaPods集成ReactiveCocoa
- Codeforces Round #336 (Div. 1) 607A Chain Reaction 简单dp
- React 学习一 运行