1. 错误打印  code=-1016 filed: text/html

错误原因:AFN默认不能解析请求回来的text/html数据

解决办法:

AFN3.0的请看这里

AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];

[manager.responseSerializer setAcceptableContentTypes:[NSSet setWithObjects:@"text/html", nil]];

AFN2.X的看这里

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];

[manager.responseSerializer setAcceptableContentTypes:[NSSet setWithObjects:@"text/html", nil]];

注意把所有的 AFN弄成-fobjc-arc (如果你的AFN是从GITHub上下的, AFN是ARC版本的)

2. 错误打印:code1002问题,get请求https的网址

在 NSURLConnection 旁边添加这个方法

- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge

{

if ([challenge previousFailureCount] == 0) {

NSURLCredential *cre = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];

[challenge.sender useCredential:cre forAuthenticationChallenge:challenge];

}

}

[AFN]AFNetworking错误总结的更多相关文章

  1. ASI与AFN网络请求的的比较

    对比 ASI AFN 更新状态 2012年10月份,已经停止更新 持续更新中,目前已更新至3.0版 介绍 ASI的直接操作对象ASIHTTPRequest,是一个实现了了NSCopying协议的NSO ...

  2. 从此走上一条iOS程序猿不归路。。。

    新的城市,新的生活!前不久刚刚结束了苦逼的面试找工作之旅,期间也小有收货,如今正处年底工作闲暇之余,将前一阵子陆陆续续的总结整理了一下,本人菜鸟程序猿一只,水平有限,本文总结的知识不算深入,比较浅显, ...

  3. linker command failed with exit code 1 (use -v to see invocation)

    library not found for -|AFNetworking 错误内容如图所示: 解决方法:1. 如果没有安装pod,则安装pod,并导入项目AFNetworking参考:http://w ...

  4. linux 实战使用,上传git 解决冲突

    Last login: Fri Dec 18 09:48:55 on ttys000lidongxiaodeiMac:~ lidongxiao$ cd /Users/lidongxiao/Docume ...

  5. Cocoapod-终端

    安装循序: Xcode->RVM->Ruby(安装过程中需要安装homebrew)->CocoaPats 参考文章: 安装地址:http://www.cnblogs.com/dagu ...

  6. 航空概论(历年资料,引之百度文库,PS:未调格式,有点乱)

    航空航天尔雅 选择题1. 已经实现了<天方夜谭>中的飞毯设想.—— A——美国2. 地球到月球大约—— C 38 万公里3. 建立了航空史上第一条定期空中路线—— B——德国4. 对于孔明 ...

  7. 简述AFN(AFNetWorking 2.X)的实现分析和简单使用【转】

    [转载] Axc注:版本为AFNetWorking 2.6    3.0需要修改大部分对象 一:声明本 人以前一直是使用ASI网络请求类库的.最近才开始了解使用AFNetworing这个类库.网上也肯 ...

  8. iOS-利用AFNetworking(AFN 1.x)-实现文件断点下载

    转:http://www.kaifazhe.com/ios_school/380066.html 官方建议AFN的使用方法 1. 定义一个全局的AFHttpClient:包含有 1> baseU ...

  9. iOS- 利用AFNetworking(AFN) - 实现文件断点下载

    https://www.cnblogs.com/qingche/p/3500746.html 1. 定义一个全局的AFHttpClient:包含有 1> baseURL 2> 请求 3&g ...

随机推荐

  1. iptables规则表

    1.iptables规则表 Filter(针对过滤系统):INPUT.FORWARD.OUTPUT NAT(针对地址转换系统):PREROUTING.POSTROUTING.INPUT.OUTPUT ...

  2. LeetCode-Largest Divisble Subset

    Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of ...

  3. .net如何判断网页是否由搜索引擎蜘蛛访问?

    判断 this.Request.UserAgent Google的蜘蛛: Googlebot百度的蜘蛛:baiduspiderYahoo的蜘蛛:Yahoo SlurpMSN的蜘蛛:MsnbotAlta ...

  4. Careercup - Google面试题 - 5765091433644032

    2014-05-08 09:32 题目链接 原题: Given a binary tree, how would you copy it from one machine to the other, ...

  5. 【Largest Rectangle in Histogram】cpp

    题目: Given n non-negative integers representing the histogram's bar height where the width of each ba ...

  6. 【Recover Binary Search Tree】cpp

    题目: Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without chan ...

  7. 基于AutoCAD的空间数据共享平台雏形

    好久没有更新博客了,今天先透露一个新的产品——AutoMap.我自己对于这个产品的定位是“基于AutoCAD的空间数据共享平台”.用一句话来概括AutoMap的功能:为用户提供一个在AutoCAD下访 ...

  8. Codeforces Round #365 (Div. 2) D. Mishka and Interesting sum 离线+线段树

    题目链接: http://codeforces.com/contest/703/problem/D D. Mishka and Interesting sum time limit per test ...

  9. Spring Mvc 返回机制

    转自:http://jianzh5.iteye.com/blog/1909234 Spring Mvc 有如下的几种返回方式: ModelAndView, Model, ModelMap, Map, ...

  10. linux下安装vsftp

    1. yum安装vsftp # yum install vsftpd 2. 配置Vsftpd 安装完之后我们要对它进行配置,才能正常使用.编辑vsftpd的配置文件vi /etc/vsftpd/vsf ...