react native下fetch ios9报network request failed的问题
2016-07-26 13:47
459 查看
环境:
RN: 0.28
iOS: 9
xcode: 7.0.1
现象:
执行以下语句时:
总是报错:
查了一堆资料,最后解决:
http需要配置info.plist,具体配置如下:
1、在Info.plist中添加 NSAppTransportSecurity 类型 Dictionary ;
2、在 NSAppTransportSecurity 下添加 NSAllowsArbitraryLoads 类型Boolean ,值设为 YES;
参考:
http://www.codes51.com/article/detail_2177325.html
RN: 0.28
iOS: 9
xcode: 7.0.1
现象:
执行以下语句时:
fetch('http://facebook.github.io/react-native/movies.json') .then((response) => response.json()) .then((responseJson) => { return responseJson.movies; }) .catch((error) => { console.error(error); });
总是报错:
Network Request Failed.
查了一堆资料,最后解决:
http需要配置info.plist,具体配置如下:
1、在Info.plist中添加 NSAppTransportSecurity 类型 Dictionary ;
2、在 NSAppTransportSecurity 下添加 NSAllowsArbitraryLoads 类型Boolean ,值设为 YES;
参考:
http://www.codes51.com/article/detail_2177325.html
相关文章推荐
- React和Backbone优缺点
- [React Native] Error Handling and ActivityIndicatorIOS
- React JSX语法说明
- react 使用 fetch 向spring mvc后台发起ajax 请求 options 403
- React.JS
- 同为javascript框架,react和angular各有什么优缺点,各自又适合什么开发场景?
- reactJS04 - reactjs简单渲染一个导航栏
- reactJS - 03利用babel来”编译”我们的脚本文件
- Jonh.Felix Stay hungry Stay foolish ReactNative&weex&DeviceOne对比
- React和Redux的连接react-redux
- React Native For Android(Windows )配置
- react native 中的ReadableMap和WritableMap的使用
- React
- 初识ReactJs(一)
- Rreact Native 常见错误总结
- React Native之ViewPagerAndroid讲解与应用
- ReactNative&weex&DeviceOne对比
- react native白屏及性能优化
- [React Native] Passing data when changing routes
- reactJS - 02分离文件