码迷,mamicode.com
首页 > Web开发 > 详细

AFNetworking 2.0 获取json数据时,返回 NSLocalizedDescription=Request failed: unacceptable content-type: text/html, 解决方法.

时间:2014-08-27 12:21:27      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:des   http   io   数据   代码   html   sp   on   htm   

 

 

 AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];

 manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];

    

 

1:优先让服务器做好返回类型适配

 

2:服务器不做的话, 在程序中再加上上面的代码. 把类型加上.

AFNetworking 2.0 获取json数据时,返回 NSLocalizedDescription=Request failed: unacceptable content-type: text/html, 解决方法.

标签:des   http   io   数据   代码   html   sp   on   htm   

原文地址:http://www.cnblogs.com/willbin/p/3938892.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!