i getting json string in failure block
nsurl *url = [[nsurl alloc] initwithstring:@"http://www.vinipost.com/services/update/updateservice.asmx/getpropsubtype?"]; nsurlrequest *request = [[nsurlrequest alloc] initwithurl:url]; [afjsonrequestoperation addacceptablecontenttypes:[nsset setwithobject:@"text/html"]]; afjsonrequestoperation *operation = [afjsonrequestoperation jsonrequestoperationwithrequest:request success:^(nsurlrequest *request, nshttpurlresponse *response, id json) { nslog(@"%@", json); } failure:^(nsurlrequest *request, nshttpurlresponse *response, nserror *error, id json) { nslog(@"request failed error: %@, %@", error, error.userinfo); }]; [operation start];
output:
request failed error: error domain=afnetworkingerrordomain code=-1016 "expected content type {( "text/json", "text/javascript", "application/json", "text/html" )}, got text/plain" userinfo=0x71521a0 {nslocalizedrecoverysuggestion=[{"proptypid":1,"propcatid":1,"proptyp":"flat/ condo"}.......**
the error clear: web service returning wrong content type. content type should 1 of these:
"text/json", "text/javascript", "application/json", "text/html"
but returns
text/plain
moreover, if @ http response, returns html tags inside it, afnetworking not able parse.
if page:
http://www.vinipost.com/services/update/updateservice.asmx/getpropsubtype?
is under control, correct behavior removing html tags , changing content type
Comments
Post a Comment