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!

4

3 に答える 3

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.

于 2012-05-08T19:01:31.650 に答える
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];
于 2012-05-09T07:17:10.087 に答える
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.

于 2012-05-08T19:03:26.373 に答える