0

I stuck with a problem. In my tableView I got a cell with a phone number. I would like to click on the phone number and make a call.

I implemented the following in didSelectRowAtIndexPath:

NSString *cifra=@"tel://123456789";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:cifra]];
NSLog(@"after call %@",cifra);

Unfortunatly it doesnt do anything. In my log it shows me my "after call ... " but it is not calling. No error, no log, no action :( It works for me with opening a website or googleMaps, but not for calling.

Is there anything i can do? Maybe a it is simple answer, but i really dont know what to do. Is there a different way to make a call?


I am using the iPhone Simulator. Is this the problem? But it should do a thing, shouldn't it? :)

Thanks for your help!

Maksim
  • 2,054
  • 3
  • 17
  • 33
Christoph Beger
  • 135
  • 2
  • 14
  • possible duplicate of [How to make a call in iphone?](http://stackoverflow.com/questions/9798822/how-to-make-a-call-in-iphone) – jscs May 08 '12 at 19:00
  • 1
    You can't use the simulator to make phone calls -- it's not an actual phone. – jscs May 08 '12 at 19:00

3 Answers3

1

You can't make calls from the Simulator.

If you want to test making a phone call, run the app on your device, then press the cell to make a phone call on your actual device.

You can simulate the in-call status bar, but there is nothing actually happening when it comes to actual phone calls.

Hardware > Toggle In-Call Status Bar

Note that using [[UIApplication sharedApplication] openURL:SOMEPHONENUMBER]; does not trigger this event.

WrightsCS
  • 50,551
  • 22
  • 134
  • 186
1

Tried this code to make a call

           NSString *prefix = (@"tel://(972)818-32432");
           UIApplication *app = [UIApplication sharedApplication];
            NSString *dialThis = [NSString stringWithFormat:@"%@", prefix];
            NSURL *url = [NSURL URLWithString:dialThis];
            [app openURL:url];
Sampath
  • 117
  • 1
  • 9
0

On top of the answers mentioning you can't make calls from the simulator, cifra should be @"tel:123456789", the double slashes aren't needed.