UIWebView tel: the telephone delegate is not called on the iPad (but it works on the iPhone)

My UIWebView shows a webpage containing the tel url: +123456789

<a href="tel:+123456789">Phone link</a> 

When I click on this link on the iPhone, my UIWebViewDelegate gets called correctly.

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

When I click on this link on the iPad, my UIWebViewDelegate is not called at all. Instead, a UIActionSheet is automatically displayed with the Add to Contacts, Copy, and Cancel options.

Is there a way to catch "tel:" HTML links from a UIWebView on a device that does not have the capabilities of a phone, for example. iPad

This behavior is the same for the simulator:

  • IPhone simulator: delegate called
  • iPad simulator: delegate not called
+4
source share
1 answer

Have you tried simply:

 if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ) { return YES; /* Device is iPad */ } 
-2
source

Source: https://habr.com/ru/post/1439831/


All Articles