This question is very similar to this one.
However, the accepted answer (and the only answer) does not solve my problem.
I have a “hybrid” iOS app containing among other things a UITabView with a set of UIWebViews showing some app content in HTML5 from a web server. Under the hood there is a little home-made cache engine that caches content in the background. This cache engine fills its data using this line
[NSData dataWithContentsOfURL:request.URL options:NSDataReadingUncached error:&error];
So far the app has worked perfectly without any problems, but in iOS 6, it is not working anymore. Using the debugger I have came to conclusion that it is the above line that is not working. When I step accross the above line it just cant load the page, and after a while I get an error 256. When I switch to iOS 5, it works perfectly.
I have printed the NSURL-object request.URL and it looks like it should and it does have the “http://”-part included, like this:
http://app.customername.com/.mvc/MobileApp/Index
I also tried loading a test page that is unrelated to the application website, a very simple html-page that I made myself, and also http://www.google.com
Both of them worked in iOS 5.1 but the same problem occurred with these pages in iOS 6.
I also tried using the method without the “Uncached” option like this, but still no luck:
[NSData dataWithContentsOfURL:request.URL]
Has something changed in iOS 6 for the method data dataWithContentsOfURL: and has someone else seen this problem?
So, I was having the same exact problem, and I don’t know the exact cause.
I’m assuming it has something to do with the NSURLCache thread not playing nice with dataWithContentsOfURL. If anybody knows why please chime in.
Bottom line, I already had ASIHTTP in my project, so I replaced this:
With this:
And now all is well.