AFNetworking 修改

相比大家刚刚拿到AFNetworking  post  和 get 请求数据的时候都会有些小问题吧  

NSLocalizedDescription=Request failed: unacceptable content-type: text/html

就是这个   修改的话很简单

解决方法:

修改AFNetworking中AFURLResponseSerialization.m文件

在223行,将

    self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", nil];

改成

    self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/html",@"text/json", @"text/javascript", nil];

增加了一个 @"text/html"

 

加入这个格式就好了

posted @ 2016-05-23 13:57  刘明鑫l  阅读(164)  评论(0编辑  收藏  举报