下面的代码工作正常,但是当我回到我的应用程序时,它会继续执行下面的代码,但我不知道为什么以及如何停止它。我认为它只发生在 ios5.0 中:app flow - rootviewcontroller -> mainviewcontroller -> webview
在 mainviewcontroller 的 webview 的 shouldstartloadrequest 方法中调用了以下代码
@property (readwrite, retain) UIWebView *_loginWebView;
...
..
- (void)viewDidLoad
{
[super viewDidLoad];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[_loginWebView loadRequest:requestObj];
}
//当webview收到打开url的请求时调用following
- (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
}
头部标签内容 -
<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>