UIApplication sharedApplication continues execution on return to application and reboot

The following code works fine, but when I return to my application, it continues to execute the following code, but I don’t know why and how to stop it. I think this only happens in ios5.0: application thread - rootviewcontroller -> mainviewcontroller -> webview

The following code is called in the shouldstartloadrequest webview method in mainviewcontroller

@property (readwrite, retain) UIWebView *_loginWebView; ... .. - (void)viewDidLoad { [super viewDidLoad]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; [_loginWebView loadRequest:requestObj]; } 

// after the call is called whenever the webview receives a request to open the url

  - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{ //return no is a special case there is more code in the method which I am not showing here if ([[UIApplication sharedApplication] canOpenURL:myURL]) { [[UIApplication sharedApplication] openURL:myURL]; } else { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:newPath]]; } return NO; } //above is a special case } 

header content -

 <head> <meta name="viewport" content="width=device-width,initial-scale=1" /> <!-- iOS Stuff --> <link rel="apple-touch-icon" href="images/...."/> <meta name="apple-mobile-web-app-capable" content="yes" /> <link rel="shortcut icon" href="favicon.ico" /> <script async="async" src="https://......."></script> <script type="text/javascript"> .......... </script> </head> 
+4
source share
3 answers

It was a bug with iOS 5.0, where if you went back to web browsing the application, put it in the foreground, it will update it ... just like safari does ...

but apple fixed this error in iOS 6.0

So there's nothing to be done.

0
source

Does myURL have a set of meta-updates in the header? If the web page reloads, this method will be called. It will also be called if there are redirects.

0
source

If I understand your question well, the problem is

  • launch your application, go to mainViewController, after loading the view, it will allow iOS to open the URL in another application.
  • another application opens, and when you return to the application, the webview automatically downloads the URL.

so the problem is why webview reloads url automaticlly.

from the above code, it doesn’t need to use a web view because the delegate always returns No and does something else.

I don’t know why this is happening now, if possible, just delete the web view, it confused this.

and this answer will be deleted.

0
source

All Articles