0

I across the following code:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8005551212"]];

on : Making phone calls on iPhone

But, it does not work for me in the simulator. I have connected the IBAction(callphone) to the ViewController(TouchUpInside). I am now not sure, is it because I am checking my code in simulator? I do not get a dialog box. Please advice.

I tried putting log statements and the action does get called since the log stamtments that I wrote to test is being printed

Community
  • 1
  • 1
iDev
  • 2,163
  • 10
  • 39
  • 64

1 Answers1

10

Can you make a phone call from your Mac? No. That's why the simulator doesn't work when you try to open a tel:// URL. You must do this from a device that can make a call: an iPhone, but not an iPad or iPod touch.

Mark Granoff
  • 16,878
  • 2
  • 59
  • 61
  • Thanks, I wanted to confirm that it would not work from a testing device. – iDev Sep 30 '12 at 00:24
  • 3
    Let's be clear with terminology. A physical "i" device is usually referred to as a "device" or "testing device". So when you say testing device, folks will assume you mean an iPhone, iPod touch, or iPad. The simulator runs on your Mac, which is a "Mac" not a "device" (for this definition of "device"). It is important always to test on a real device, no matter what your app does, because the device environment is really quite different from the simulator. For example, only a real iPhone can make a call. – Mark Granoff Sep 30 '12 at 00:27