用IOS AFNetWorking 框架时,调用AFJSONRequestOperation出错

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";
        }

 

解决办法:请求前加入

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

 

posted @ 2013-05-30 17:24  茄瓜写程序  阅读(958)  评论(0)    收藏  举报