使用AFNetworking 2.0 请求数据时出现错误 Request failed: unacceptable content-type: XXXX 解决方法
来源:互联网 发布:淘宝搜索排名优化 编辑:程序博客网 时间:2024/06/01 19:20
如果是unacceptable content-type:text/html
添加一行
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
如果是unacceptable content-type:application/rss+xml添加一行manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"application/rss+xml"];改后:AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"]; NSDictionary *parameters = @{@"foo":@"bar"}; [manager POST:@"http://example.com/resources.json" parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@"JSON: %@",responseObject); } failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(@"Error:%@",error); }];
参考:
http://stackoverflow.com/questions/19830882/unacceptable-content-type-application-rssxml-when-using-afnetworking-2-0
http://www.cnblogs.com/xiongqiangcs/p/3459841.html
0 0
- 使用AFNetworking 2.0 请求数据时出现错误 Request failed: unacceptable content-type: XXXX 解决方法
- 使用AFNetworking 2.0 请求数据时出现错误 Request failed: unacceptable content-type错误解决方法
- 使用AFNetworking 2.0 请求数据时出现错误 Request failed: unacceptable content-type: text/html 解决方法
- 使用AFNetworking 2.0 请求数据时出现错误 Request failed: unacceptable content-type: text/html 解决方法
- 使用AFNetworking网络请求时出现错误"Request failed: unacceptable content-type: text/html"
- AFNetWorking 请求数据报”Request failed: unacceptable content-type: text/plain” 错误解决方法
- AFNetWorking 请求数据报”Request failed: unacceptable content-type: text/plain” 错误解决方法
- AFNetWorking请求时, “Request failed: unacceptable content-type: text/html”
- 解决AFNetWorking 请求数据报”Request failed: unacceptable content-type: text/plain” 错误
- AFNetworking 错误 Request failed: unacceptable content-type: text/plain
- AFNetWorking 错误Request failed: unacceptable content-type: text/html"
- AFNetworking不支持text/plain,错误解决方法"Request failed: unacceptable content-type: text
- iOS 使用AFNetworking遇到错误 Request failed: unacceptable content-type: text/html
- iOS 使用AFNetworking遇到错误 Request failed: unacceptable content-type: text/html
- AFNetworking 报错 Request failed: unacceptable content-type: text/html
- AFNetworking 报错Request failed: unacceptable content-type: text/html"
- 使用AFNetworking遇到异常 Request failed: unacceptable content-type: text/html
- iOS 使用AFNetworking遇到异常 Request failed: unacceptable content-type: text/html
- 如何快速开发一个智能聊天机器人
- 求职中我们的主要困惑!
- 一系列MFC操作文件实例(中)
- MD5加密
- How to add Oracle JDBC driver in your Maven local repository
- 使用AFNetworking 2.0 请求数据时出现错误 Request failed: unacceptable content-type: XXXX 解决方法
- HTML5将在未来扮演一个必不可少的角
- android listview 滚动时异步加载图片的问题
- cpc专家:可以对股市说拜拜 黄金比较安全
- 网络营销要赢得销售必须先赢得消费者
- Java桌面程序jar打包成exe可执行文件
- C语言高效编程的四大秘技之使用位操作,减少除法和取模的运算
- 转为json时排除不需要的属性
- iOS由一个控制器导航到另一个控制器的方法