这是this question
当我设置mywebview.datadetectortypes=uidatadetectortypenone;电话链接(在a href html标记中)的处理方式如下:
iphone - dataDetectorTypes电话链接问题-LMLPHP
如何使用shouldstartwoadwithrequest委托方法处理电话链接?

最佳答案

我还没有找到问题的原因,但我找到了解决办法。
我写allo:myphonenumber,而不是像tel:myphonenumber这样在锚中编写电话链接。
因此,shouldStartOAdWithrequest方法被调用。我可以在我的NSURLRequest对象中替换allo:by-tel:
编辑,代码如下:

- (BOOL)webView:(UIWebView *)webView
    shouldStartLoadWithRequest:(NSURLRequest *)request
     navigationType:(UIWebViewNavigationType)navigationType; {

      NSURL *requestURL = [[ request URL] retain];
      // Check to see what protocol/scheme the requested URL is.

      if (
          // ( [ [ requestURL scheme ] isEqualToString: @"http" ] || [ [ requestURL scheme ] isEqualToString: @"https" ] ) &&
          ( navigationType == UIWebViewNavigationTypeLinkClicked )
          ) {

        // Stats
        [self recordTouch: [self tagToZone:[[webView superview] tag]]];

        // Substitution allo -> tel
        NSURL *newURL = [[NSURL alloc] initWithString: [[[request URL] absoluteString] stringByReplacingOccurrencesOfString: @"allo:" withString: @"tel:"]];
        [requestURL release];

        //return YES;

        // Launch
        return ![ [ UIApplication sharedApplication ] openURL: [newURL autorelease]];
      }

      // Auto release
      [requestURL release];
      return YES;
    }

10-04 11:03