AFNetworking stopped working under iOS 6

I recently noticed that my code that uses AFNetworking (the latest version from the main branch) stops working under iOS 6. Here is my code:

httpClient = [AFHTTPClient clientWithBaseURL:[NSURL URLWithString:baseURL]]; httpClient.operationQueue.maxConcurrentOperationCount = 1; 

where httpClient is a class variable.

Then I create a query:

 NSMutableURLRequest *signInRequest = [httpClient requestWithMethod:@"POST" path:@"/user/register" parameters:dataToSend]; signInRequest.timeoutInterval = 15.0; signInRequest.cachePolicy = NSURLRequestReloadIgnoringLocalAndRemoteCacheData; AFJSONRequestOperation *signInOperation = [AFJSONRequestOperation JSONRequestOperationWithRequest:signInRequest success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) { // Blah } failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) { // Blah }]; [httpClient enqueueHTTPRequestOperation:signInOperation]; 

All other queries are constructed similarly. The first running operation works well, I can get into the success handler block. However, the following calls to other requests end in error processing and a request timeout error, regardless of how large the timeout value that I choose.

I made the same calls using plain NSURLConnection , writing tons of code :), the requests were successfully processed properly.

I switched to iOS 5 device and the code above works fine.

I switched to a 3G connection (iOS 6) and the code above works.

It seems that I only have this problem in WiFi connections (except when I'm on the same subnet with my REST server.)

Any thoughts on this?

Thanks in advance.

+7
source share
1 answer

It seems you also posted a question about AFNetworking github and yourself found a solution :)!

It seems that iOS 6 is changing something in the TCP implementation or something like that. I moved the server to a third-party hosting, and now it works.

For future readers, the problem can be found here .

+2
source

All Articles