Question

I am seeing an issue with iOS6, AFNetworking and NSURLConnection that doesn't make any sense.

To reproduce the issue

  • Make a request, any request, and make sure its successful
  • Turn off the internet connectivity
  • Launch the app again and make the same request again

iOS5.1

2012-10-09 15:30:43.667 CACHE TEST[3811:1bb03] <NSMutableURLRequest http://myserver.in/someImage.png>
2012-10-09 15:30:43.674 CACHE TEST[3811:1bb03] -[AFURLConnectionOperation connection:didReceiveData:]
2012-10-09 15:30:43.675 CACHE TEST[3811:1bb03] -[AFURLConnectionOperation connectionDidFinishLoading:]

Data is picked up [from NSURLCache I assume], and connectionDidFinishLoading is called.

iOS6.0

2012-10-09 15:32:34.578 CACHE TEST [3877:1e903] <NSMutableURLRequest http://myserver.in/someImage.png>
2012-10-09 15:32:34.578 CACHE TEST [3877:1e903] -[AFURLConnectionOperation connection:didFailWithError:]

Data is NOT picked up [I verified that the NSURLCache's Cache.db does have that image in the sqlite db as a blob], and connection:didFailWithError: is called.

I did not find anything in the API diffs that would suggest that there's been any relevant change in either NSURLConnection, NSURLRequest or NSURLCache.

The result is that while the success block is called when the app is run offline on 5.1, the failure block gets called on iOS6.0

UPDATE

Wrote a test to confirm that the NSURLConnection, NSURLRequest or NSURLCache do not behave differently.

Find it at http://github.com/abhinittiwari/NSURLCacheTest

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top