how , in code can handle responses server when requests using afnetworking? can't find detailed , full example.
interested in situation:
exceeded timeout of response (for example, 5 seconds, server not responding due bad internet)
there no internet @ all
error in script on remote server
internal server error / prevention.. etc. of common causes.
i want show different alertview depending on response code server.
example query:
nsstring * url = @"http://supersite.ru/script.php"; nsurl * nsurl = [nsurl urlwithstring:url]; nsurlrequest *request = [nsurlrequest requestwithurl:nsurl]; afhttprequestoperation *operationfeedback = [[afhttprequestoperation alloc] initwithrequest:request]; operationfeedback.responseserializer = [afjsonresponseserializer serializer]; [operationfeedback setcompletionblockwithsuccess:^(afhttprequestoperation *operation, id jsonresponse){ // ... handling response } failure:^(afhttprequestoperation *operation, nserror *err) { // ... , need handle response code?! }]; [operationfeedback start];
Comments
Post a Comment