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:

  • UIWebView Load starts to load
  • failed to load

    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:

    • Whether the phone has a data connection after the initial load failed I'm called IBAction, but my NSLogs do not call me either webViewDidStartLoad, webViewDidFinishLoad, and nor webViewâ ?? didFailLoadWithError

      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:

        - (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:

        - Reload (IBAction) Webview {[reload webView]; NSLog (@ "reload"); }   

      webViewDidStart, DidFinish, didFailLoadWithError: - (zero) webViewDidStartLoad: (UIWebView *) webView {NSLog (@ "start load"); } - (zero) webViewDidFinishLoad: (UIWebView *) webView {NSLog (@ "Finish Load"); } - (zero) webview: (UIWebView *) webView didFailLoadWithError: (NSError *) Error {NSLog (@ "Dead Fail"); }

      Thoughts?

      It's a good way to check whether you're troubled even trying to load a webpage. should be there.

        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   

      If you can not start loading webview even when no connection is possible, you are likely to be completely out of this scenario.

      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 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

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -