views:

43

answers:

1

I'm currently developing an iPhone app for a mall.

One of the features is the ability to phone a mall tenant from within the app. I'm using

NSURL *url = [[NSURL alloc] initWithString:@"tel:1(480)555-5555"];
[[UIApplication sharedApplication] openURL:url];

It works as I expect it to, no confirmation dialog and remains in the phone app when the call is completed. I'd rather it return to our app, but whatever...

However, there is another page in the app that is a webview and there are a couple of phone numbers that have been automatically detected. Upon clicking one, the confirmation dialog box opens, and the user is returned to our app.

I'm a little ticked that the behaviour that I want, and was seemingly removed between 3.0 and 3.1, exists in a webview. Ideally, I'd like any phone number to return a user to our app, but I'm okay with neither of them doing it. I just want it to be consistent throughout my app.

Is there a different call I should be using? Can I change the behaviour of phone numbers that have been automatically detected in a webview? (besides disabling it)

A: 

Unfortunately, this is not simple to do. The UIWebViewDelegate callback - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType should allow you to intercept these taps but it does not. (Note: in the simulator it does appear to work, but on device it doesn't...) My guess is that the only way to intercept these taps would be at the window level and that would probably be more work than it is worth.

MattLeff