webview - iPhone - UIWebView not calling didFailLoadWithError without data connection -
I have searched and have not found the solution, so hopefully someone can help you < P> I have a UIWebView that is called when a user clicks a button until the phone does not account for behavior without a data connection, everything works well.
When you try to open UIWebView for before time on airplane mode or without phone, a data connection: Once the UIWebView is allocated and loaded to fail, the first time IBAction is connected to a refresh Reasons to kill the button (which calls [webView reload]) reasons: If I'm running an app and the device Turn on a data connection (for example, to turn off airplane mode), go back to my app and press the Fresh button, called [webView reload], but did not say webViewDidStartLoad (and thus webViewDidFinishLoad) goes. Here is the relevant code: To bring the webview: Reload: webViewDidStart, DidFinish, didFailLoadWithError: Thoughts? It's a good way to check whether you're troubled even trying to load a webpage. should be there. If you can not start loading A fix for strange behavior, though: try to check in your fresh method whether it has been loaded at all now, and if not then on
- (IBAction) loadWebView {webView = [[UIWebView alloc] init] ; WebView.scalesPageToFit = Yes; [Webview Set Deliget: Self]; NSString * urlAddress = @ "http://google.com"; NSURL * url = [NSURL URLWithString: urlAddress]; NSURLRequest * requestObj = [NSURL request request with url: url]; [WebView loadRequest: requestObj]; }
- Reload (IBAction) Webview {[reload webView]; NSLog (@ "reload"); }
- (zero) webViewDidStartLoad: (UIWebView *) webView {NSLog (@ "start load"); } - (zero) webViewDidFinishLoad: (UIWebView *) webView {NSLog (@ "Finish Load"); } - (zero) webview: (UIWebView *) webView didFailLoadWithError: (NSError *) Error {NSLog (@ "Dead Fail"); }
NetworkStatus currentStatus = [[the intranet connection reaching the reach] Current RebirthStatus]; If (current status == kReachableViaWWAN) // 3G and if (current status == kReachableViaWifi) // wifi else (current status == kNotReachable) // no connection is currently not possible
webview even when no connection is possible, you are likely to be completely out of this scenario.
loadRequest: requestObj For example, call:
- reload (IBAction) web view {if (webView.request! = Nil) [webView reload]; Else {// Reconstruction Request obz is here, or use a class member [webView loadRequest: requestObj]; } NSLog (@ "reload"); }
Comments
Post a Comment