美文网首页
iOS开发基础性知识(十)----AF常见报错及处理

iOS开发基础性知识(十)----AF常见报错及处理

作者: NBeanN | 来源:发表于2017-05-04 11:42 被阅读86次

一、Error Domain=NSURLErrorDomain Code=-1002 "不支持的 URL" UserInfo={NSUnderlyingError=0xb128320 {Error Domain=kCFErrorDomainCFNetwork Code=-1002 "不支持的 URL" UserInfo={NSLocalizedDescription=不支持的 URL}}, NSLocalizedDescription=不支持的 URL}

解决方法:

111111

二、Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}

解决方法:

222222

三、Error Domain=AFNetworkingErrorDomain Code=-1016 "Request failed: unacceptable content-type: text/json" UserInfo={NSErrorFailingURLKey=http://www.baidu.com/post.do, AFNetworkingOperationFailingURLResponseErrorKey={ URL: http://www.baidu.com/post.do } { status code: 200, headers {

"Access-Control-Allow-Credentials" = true;

"Access-Control-Allow-Headers" = "X-Requested-With";

"Access-Control-Allow-Methods" = "GET,POST";

"Access-Control-Allow-Origin" = "*";

Connection = "keep-alive";

"Content-Length" = 1514;

"Content-Type" = "text/json;charset=UTF-8";

Date = "Sat, 09 Jan 2016 09:40:32 GMT";

Server = "nginx/1.6.2";

} }, NSLocalizedDescription=Request failed: unacceptable content-type: text/json}

解决方法:

333333

四、-9802

解决方法:

444444

五、-1012

解决方法:

555555 666666

//    AFSecurityPolicy *securityPolicy = [AFSecurityPolicy defaultPolicy];

//    securityPolicy.allowInvalidCertificates = YES;

//    manger.securityPolicy = securityPolicy;

#import<SystemConfiguration/SystemConfiguration.h>

#import<MobileCoreServices/MobileCoreServices.h>

#define AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES

站在巨人的肩膀上才有这些总结

菜鸟走向大牛,大家共同前进,如果觉得不错,请给个赞/关注。

一起交流学习,有问题随时欢迎联系,邮箱:383708669@qq.com

相关文章

网友评论

      本文标题:iOS开发基础性知识(十)----AF常见报错及处理

      本文链接:https://www.haomeiwen.com/subject/qoektxtx.html