iOS-用IOS AFNetWorking 框架出现如下错误

前端开发 前端开发 主题:1148 回复:2395

iOS-用IOS AFNetWorking 框架出现如下错误

想挽留 发布于 2017-05-16 字数 894 浏览 1075 回复 1

2012-08-17 16:51:36.211 SeasonalFruits[437:c07] Request Failed with Error: Error Domain=com.alamofire.networking.error Code=-1016 "Expected content

type {(
"text/json",
"application/json",
"text/javascript"
)}, got text/html" UserInfo=0x6d7dc80 {NSErrorFailingURLKey=http://10.10.10.109:8090/fruit/index.php/list/fruitlist/?p=1, NSLocalizedDescription=Expected content type {(
"text/json",
"application/json",
"text/javascript"
)}, got text/html}, {
NSErrorFailingURLKey = "http://10.10.10.109:8090/fruit/index.php/list/fruitlist/?p=1";
NSLocalizedDescription = "Expected content type {(n "text/json",n "application/json",n "text/javascript"n)}, got text/html";
}

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

支持 Markdown 语法,需要帮助?

评论(1

晚风撩人 2017-06-25 1 楼

在网络请求之前添加

[AFJSONRequestOperation addAcceptableContentTypes:[NSSet setWithObject:@"text/html"]];