iOS - NSURLConnection finished with error - code -1002
网络请求会异常,比如报错:Error domain: @"NSURLErrorDomain" - code: 在回调的地方打一个断点,然后用命令行查看下什么错误: po error
当错误是:**[Error Domain=NSURLErrorDomain Code=- ] "unsupported URL" **
*Error Domain=NSURLErrorDomain Code=- "unsupported URL" UserInfo={NSLocalizedDescription=unsupported URL, NSUnderlyingError=0x7fa9b1d06120 {Error Domain=kCFErrorDomainCFNetwork Code=- "(null)"}} * 的时候是url编码问题,处理一下URL编码就好了 我这边是后台返回的拼接的接口多了“/”,导致统一的域名格式不统一
http://gwtest.opg-iot.com:8000//api-sdeventApplication/images/handle/event_result/event_result_beimg_20190522093224_0.jpeg?Authenticator=eyJhbGciOiJIUzI1NiJ9.eyJyZWFsTmFtZSI6bnVsbCwibG9naW5OYW1lIjoiU0Q3MzkzIiwidXNlclR5cGUiOiIxIiwicGxhdGZvcm1JZCI6MTAsImV4cCI6MTU1OTA5MzkxOSwidXNlcklkIjo3MzkzfQ.KieGb8LUsgpvn9BU9jjSiNSNn12irclYKiPH_s0Uqgk
处理方法:
iOS 要用utf8转码:
urlString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
iOS 以后要用这个方法:
urlString = [urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"#%^{}\"[]|\\<> "].invertedSet];
iOS - NSURLConnection finished with error - code -1002的更多相关文章
- 解决NSURLConnection finished with error - code -1100错误
更新到xcode9以后,拖进工程中一个html文件,webview加载这个文件,xcode一直抛出 NSURLConnection finished with error - code -1100异常 ...
- WebView loadRequest请求错误"NSURLConnection finished with error - code -1022"
执行下面代码 [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www ...
- 解决 React-Native mac 运行报错 error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by ope
React-Native 开发的项目,Android 方面没有任何问题,IOS 就是无法跑起来,报错信息如下: mac 10.14.4 xcode 10.2.1 error Failed to bui ...
- IOS真机调试找不到设备:ERROR: Could not connect to lockdownd, error code -[x]
报错信息: Could not connect to lockdownd, error code -3 解决方法:修改var/db/lockdown文件夹的读写权限 在终端找到文件夹cd var/db ...
- Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details
thinkphp 在Apache上配置启用伪静态,重启Apache1 restart 竟然失败了,报错 Job for httpd.service failed because the control ...
- 不受支持的URL Statue Code 1002
1. 错误提示: Error description=Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" User ...
- Android-AndroidStudio-AVD启动不了-emulator: Process finished with exit code 1
注意:解决此错误目前只针对Windows系统的电脑: 1.AndroidStudio-->AVDManager(Create Virtual Device): 2.提示AVD启动不了,同时Eve ...
- ios错误码:NSError对象.code
1. URL Loading System Error Codes These values are returned as the error code property of an NSError ...
- ORA-00600: internal error code, arguments: [2662], [0], [1106971], [0], [1107731], [12583040]
今天是2014-06-06,在进行数据库恢复的时候出现了一个久违的ora-600 [2662]错误.特整理例如以下: 问题描写叙述: system及数据文件误删,採用恢复数据文件的方式将数据库恢复到開 ...
随机推荐
- nohup 、&、 2>&1 命令分析
nohup的意思是不间断的运行,&的意思是后台运行,2>&1的意思是标准输出和错误输出都重定向到同一个文件. 简单地说nohup运行时即使关掉控制台,它该运行还是运行. http ...
- 缺jar包异常:java.lang.NoClassDefFoundError: org/springframework/core/convert/support/PropertyTypeDescriptor
严重: StandardWrapper.Throwable java.lang.NoClassDefFoundError: org/springframework/core/convert/suppo ...
- python-uiautomator2
简单介绍 python-uiautomator2是一个自动化测试开源工具,仅支持Android平台的原生应用测试. 支持平台及语言 python-uiautomator2封装了谷歌自带的uiautom ...
- 教你如何解决WIN 10系统睡眠无法唤醒
1.右击“开始菜单”,选择“电源选项”. 2.选择“更改计算机睡眠时间”. 3.选择“更改高级电源设置”. 4.选择“还原计划默认值”. 5.在弹出的对话框中选择“是 ”. 6.最后选 ...
- django-评论
视图函数views.py # 订单评论 class OrderCommentView(View): def get(self, request, order_id): # 获取用户信息 user = ...
- React中组件通信的几种方式
https://segmentfault.com/a/1190000012361461 需要组件之进行通信的几种情况 父组件向子组件通信 子组件向父组件通信 跨级组件通信 没有嵌套关系组件之间的通信 ...
- Virtual DOM--react
Consider a DOM made of thousands of divs. Remember, we are modern web developers, our app is very SP ...
- @EnableFeignClients 客户端详细
在Spring cloud应用中,当我们要使用feign客户端时,一般要做以下三件事情 : 1.使用注解@EnableFeignClients启用feign客户端: 示例 : @SpringBootA ...
- RabbitMQ六种队列模式-路由模式
前言 RabbitMQ六种队列模式-简单队列RabbitMQ六种队列模式-工作队列RabbitMQ六种队列模式-发布订阅RabbitMQ六种队列模式-路由模式 [本文]RabbitMQ六种队列模式-主 ...
- github Actions 使用方法
http://www.ruanyifeng.com/blog/2019/09/getting-started-with-github-actions.html Actions 是github提供的持续 ...