1

I have been trying to determine whether a device is able to make a phone call, including with the new iOS9 Continuity features which allow iPads to make phone calls when connected to an iPhone. Presently my code looks something like this:

NSURL *call = [NSURL URLWithString:[NSString stringWithFormat:@"tel:1111111111"]];
if([[UIApplication sharedApplication] canOpenURL:call])
{
    [[UIApplication sharedApplication] openURL:call];
}
else
{
    //show an alert
}

However, when I run this on an iPad (whether or not the iPad has the phone call through an iPhone enabled) the canOpenURL function always returns true. Is there any way to distinguish whether an iPad or iOS device will make a phone call as opposed to whether it theoretically could (if a phone were connected) make the call?

trumpeter201
  • 8,487
  • 3
  • 18
  • 24
  • i think the url sceme looks for the phone application rather than ability of making a call! – Teja Nandamuri May 18 '16 at 20:24
  • I think you're right, and I'm pretty sure that's why it's not working. However, I can't find any method that either determines whether openURL is actually completed or determines if the device will make a phone call when prompted. – trumpeter201 May 18 '16 at 20:25
  • Check the return value of `openURL:`. – rmaddy May 18 '16 at 20:45
  • The return value, whether or not calls from iPhone is enabled, is YES. – trumpeter201 May 18 '16 at 20:58
  • Did you ever find a solution? – romero-ios Jan 18 '17 at 21:33
  • I'm using a workaround that first checks canOpenURL: then attempts to make the call, An NSTimer with a delay of 1.5 seconds is called which checks to see if the application state is active, if it is, I assume the call cannot be made. – trumpeter201 Feb 11 '17 at 20:00

0 Answers0