UIWebView phone links detection on iphone

there is something strange in my code. I’m sure to forget something but i don’t know what. I try to handle phone, sms mailto and http links in an UIWebView.

This is how i try :

  • how to add animation to launch screen in iOS 9.3 using Objective c
  • Is it possible to hide the address bar in iOS 7 Safari?
  • Calling javascript from objective-c code
  • MKMapView and CLLocationManager
  • Determine the Device Orientation and its resulting Angle on one Dimension?
  • UILabel text Issue in iphone
  • 1/ instantiate the UIWebView :

    webview = [[UIWebView alloc] initWithFrame:CGRectMake(0,0,320,460)]; 
    webview.opaque = NO;
    webview.backgroundColor = [UIColor clearColor];
    webview.userInteractionEnabled = YES;
    webview.dataDetectorTypes = UIDataDetectorTypeAll;
    

    2/ set the appropriate delegate :

    [webview setDelegate: self];
    

    3/ implement the delegate method (simplified version here) :

    - (BOOL)webView:(UIWebView *)webView
     shouldStartLoadWithRequest:(NSURLRequest *)request
      navigationType:(UIWebViewNavigationType)navigationType; {
    
      NSURL *requestURL = [[ request URL] retain];
      NSLog(@">>> %@", [requestURL scheme]);
      [requestURL release];
      return YES;
    }
    

    With my debug device when i touch an http link, the NSLog is printed. When i touch a tel link i have this kind of confirmation message :

    alt text http://img.ioscake.com/iphone/bug.gif

    With the iPhone Simulator, tel and http links are correctly printed by NSLog.

    Weird, no ?

    Solutions Collect From Internet About “UIWebView phone links detection on iphone”

    For anyone looking at this now, this will do it:

    self.webView.dataDetectorTypes = UIDataDetectorTypeNone;