React Native中Image报错Missing request token for request: <NSMutableURLRequest: 0x..>{URL:...png}
来源:互联网 发布:mac safari 强制刷新 编辑:程序博客网 时间:2024/06/11 15:18
首先贴出来报错:
这个问题,是因为用Image组件请求网络图片的时候,每刷新十次会有一次没有请求到,偶然出现的报错。
解决这类问题,一定要对图片的URL地址进行判空:
源码供上:
{ Filter.isNotEmpty(this.props.upgradeObj) && Filter.isNotEmpty(this.props.upgradeObj.imgUrlPath) ? <TouchableOpacity activeOpacity={1}onPress={() => this.onPressBannerConfig(this.props.upgradeObj)}> <Image source={{uri: this.props.upgradeObj.imgUrlPath}} style={{width: deviceWidth * 0.76, height: deviceWidth * 0.84 ,resizeMode: Image.resizeMode.contain}}/> </TouchableOpacity> : null}
如何判断对象不为空:
/*判断对象为空*/ isEmpty(obj){ if(typeof (obj) != 'number' && (!obj || obj == null || obj == ' ' || obj == undefined || typeof (obj) == 'undefined')){ return true; } return false; }, /*判断对象不为空*/ isNotEmpty(obj){ if(!this.isEmpty(obj)){ return true; } return false;}
阅读全文
1 0
- React Native中Image报错Missing request token for request: <NSMutableURLRequest: 0x..>{URL:...png}
- scrapy下载图片时,图片链接报错Missing scheme in request url: %s' % self._url
- 【问题处理】Mac上React Native的fetch请求报错Network request failed解决办法
- request中url
- ValueError: Missing scheme in request url: h
- ValueError: Missing scheme in request url: h
- WSO2 IS 4.6.0 报错:Access token identifier is not present in the validation request
- react native fect network request failed
- React Native Network Request Failed解决方案
- 解决react native使用fetch函数在ios9报network request failed的问题
- react native下fetch ios9报network request failed的问题
- React Native报错: Image(View, Text....) is not defined.
- React Native报错: Image(View, Text....) is not defined.
- Image Request
- rmi中,request.getParamteres()报错解决办法
- cinder list 报错:ERROR: Malformed request url (HTTP 400)
- React Native 开发报错 No bundle URL present
- react-native run-ios 报错 No bundle url present
- Source Insight显示文件完全路径
- tencentSonic框架
- 20170811工作记账流水(2017-08-11 10:00)
- hdfs远程连接hadoop问题与解决
- Android 开发者必知必会的权限管理知识
- React Native中Image报错Missing request token for request: <NSMutableURLRequest: 0x..>{URL:...png}
- mac 下mysql忘记密码解决办法
- OpenCV学习笔记15-图像金字塔
- dom窗口关闭运行端口pid
- TP5模型修改器和读取器
- PymongoDB
- 关于解决jsp页面无法正常解析EL表达式的问题
- 每天几道面(笔)试题
- SpringMVC+JWT+Swagger UI+RestFul