Make call from iPhone

NSString, UIDevice

– (IBAction)buttonActionCallOne:(id)sender
{

NSString *PhoneNumber = self.textFieldOne.text;
NSURL *phoneUrl = [NSURL URLWithString:[NSString  stringWithFormat:@”telprompt:%@”,PhoneNumber]];

if ([[UIApplication sharedApplication] canOpenURL:phoneUrl])
{
[[UIApplication sharedApplication] openURL:phoneUrl];
}
else
{
UIAlertView *calert = [[UIAlertView alloc]initWithTitle:@”Alert” message:@”Call facility is not available!!!” delegate:nil cancelButtonTitle:@”ok” otherButtonTitles:nil, nil];
[calert show];
}

}

Leave a comment