views:

979

answers:

1

Hi, 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 :

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

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

Weird, no ?

A: 

here is my ugly solution

lefakir