tags:

views:

276

answers:

0

I have a WebView that loads a simple html page in my resources folder. The page contains links. When the user touches on a link to a Web site, the iPhone will close my app and open Safari. Since the user may not want to leave my app right now, I use:

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

to trap the link touch and show him an alert box, asking him to confirm that he wants to leave my app and go to Safari right now.

Same for an email link, which would close my app and open the user's email program.

However, if I want to similarly trap when the user touches a "tel:402-555-1212" phone call link, it works on the simulator, but on the real device I just get a simple alert box that says "call 4025551212": it clearly is ignoring my custom code for the telephone number link.

Is that a bug? It happens the same way (success on simulator, not on iphone) whether or not I select "detects phone numbers" for the webview in IB. How do I get this to work on the iPhone?

2) And very closely related question: if I click to allow the phone call to happen, when the phone call ends my app returns to its opening page, closing all other views. Is this normal function? There was no memory warning. Did the phone close and then re-open my app? It doesn't do that if click on a link and go to safari: when I close safari my app doesn't open again.

Thanks in advance for any insight.

--Steve