标签:sse rdo setw type pwd operation objc 下标 task
1.//以下写一下关于AFNetworking2.0的GET数据请求问题。刚開始的时候没有写以下标红的代码,所以导致有一个问题。错误显演示样例如以下: Error: Error Domain=AFNetworkingErrorDomain Code=-1016 "Request failed: unacceptable content-type: text/html" UserInfo=0x913a3b0 {NSErrorFailingURLKey=http://192.168.1.160/mm/app/index.php?com=com_appService&method=save&app_com=com_passport&task=app_doLogin& ID=ceshi008&PWD=E10ADC3949BA59ABBE56E057F20F883E&devices_type=ios&devices_token=f32ba695aa7e7a395e862784780efae47740c9498d999ee5cc 8f3b34a14d3b96, AFNetworkingOperationFailingURLResponseErrorKey=<NSHTTPURLResponse: 0x9060f30> { URL: http://192.168.1.160/mm/app /index.php?com=com_appService&method=save&app_com=com_passport&task=app_doLogin&ID=ceshi008&PWD=E10ADC3949BA59ABBE56E057F20F883E&d evices_type=ios&devices_token=f32ba695aa7e7a395e862784780efae47740c9498d999ee5cc8f3b34a14d3b96 } { status code: 200, headers { "Cache-Control" = "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"; Connection = "Keep-Alive"; "Content-Length" = 83; "Content-Type" = "text/html; charset=utf-8"; Date = "Fri, 23 May 2014 01:53:49 GMT"; Expires = "Thu, 19 Nov 1981 08:52:00 GMT"; "Keep-Alive" = "timeout=5, max=100"; Pragma = "no-cache"; Server = "Apache/2.2.9 (APMServ) mod_ssl/2.2.9 OpenSSL/0.9.8h PHP/5.2.6"; "Set-Cookie" = "PHPSESSID=6b6581c54a5301bcc1808696e83eab52; path=/"; "X-Powered-By" = "PHP/5.2.6"; } }, NSLocalizedDescription=Request failed: unacceptable content-type: "text/html"} AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"]; [manager GET:@"<del>http://192.168.1.160/mm/app/index.php?com=com_appService&method=save&app_com=com_passport&task=app_doLogin& ID=ceshi008&PWD=E10ADC3949BA59ABBE56E057F20F883E&devices_type=ios&devices_token=f32ba695aa7e7a395e862784780efae47740c9498d999ee5cc 8f3b34a14d3b96</del>" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@"JSON: %@", responseObject); } failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(@"Error: %@", error); }]; 2.关于POST请求也存在同样的问题。我这里没有真实測试。仅仅是简单測了一下,貌似能够,跟上面的问题是一样的解决方法。
标签:sse rdo setw type pwd operation objc 下标 task
原文地址:http://www.cnblogs.com/zhchoutai/p/6834587.html