一般来说是URL中少了http://或https://
示例:
- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
// Intercept the external http requests and forward to Safari.app
// Otherwise forward to the PhoneGap WebView
if ([[url scheme] isEqualToString:@"http"] || [[url scheme] isEqualToString:@"https"]) {
[[UIApplication sharedApplication] openURL:url];
return NO;
}
else {
return [ super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ];
}
}
if ([url.scheme isEqualToString:@"file"]) {
NSLog(@"Open start page");
[[UIApplication sharedApplication] openURL:url];
return NO;
}
本文介绍了一种方法,用于在iOS应用中拦截并转发外部HTTP请求至Safari.app,以实现更安全高效的网络访问控制。
5445

被折叠的 条评论
为什么被折叠?



