我正在尝试使用如下锚标记链接到外部链接:Google。
为了做到这一点,我在 appDelegate.m 中添加了这段代码(代码来自这里:https ://gist.github.com/2012253 ):
- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
NSURL *url = [request URL];
// 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 ];
}
}
但我仍然无法链接到谷歌......我做错了什么吗?需要一些帮助。