Search code examples
iphoneobjective-ciosuitableviewdidselectrowatindexpath

Make a Call from UITableViewCell


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!


Solution

  • 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.