Advertise with us

How can I manage Calling on iPhone?

I am creating an iPhone application which will manage calls. But I am not understanding how can I manage it.
Can anyone clearify my issue, please provide me code if possible.
Thank you.
Last updated:12/28/2015 11:31:22 PM

1 Answers

Tarun Kumar
Tarun Kumar

The example I have provided below will be helpful and solve your problem because I have also use it in our own application.
This code will execute only on Device not on simulator:

NSString *tel_Number = @"+913337979111";
NSURL *tel_URL = [NSURL URLWithString:[NSString  stringWithFormat:@"telprompt:%@",tel_Number]];
if ([[UIApplication sharedApplication] canOpenURL:tel_URL]) {
    [[UIApplication sharedApplication] openURL:tel_URL];
} else {
    UIAlert *alert = [[UIAlertView alloc]initWithTitle:@"Alert" message:@"Calling functionality is not available in simulator, please use Device!" delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil, nil];
    [alert show];