i create a simple browser that can load a local file using UIWebview. At first,when i try to preview a html file, the uiwebview can load the source file and preview it. But after i minimize the app (the app enter background), and then open the app again, i've got this error :
Error Dict: {
NSNetServicesErrorCode = "-72000";
NSNetServicesErrorDomain = 10;
}
and after that, the uiwebview can not load the source file, when i log the error in (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
, it shows this message :
Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo=0x53d610 {NSErrorFailingURLStringKey=http://localhost:9898/local/a.html?83C66B33-874C-41A7-BBF5-78D1615512DF, NSErrorFailingURLKey=http://localhost:9898/local/a.html?83C66B33-874C-41A7-BBF5-78D1615512DF, NSLocalizedDescription=Could not connect to the server., NSUnderlyingError=0x5ccaa0 "Could not connect to the server."}
the app isn't crash, but the spinning indicator is never stop.
could somebody tell me what cause this case? and how to solved it?
Thank you :)
Sergiu Todirascu's comment in the question solved it for me. The Mac Sandbox was causing this, I had to turn on Networking, in my case Incoming and Outgoing network checkboxes, in the entitlements tab. Creating an answer so it is more easy to see.