How to make a call programmatically?

Keep the phone number in a separate string.

NSString *phoneNumber = @"1-800-555-1212"; // dynamically assigned
NSString *phoneURLString = [NSString stringWithFormat:@"tel:%@", phoneNumber];
NSURL *phoneURL = [NSURL URLWithString:phoneURLString];
[[UIApplication sharedApplication] openURL:phoneURL];

Leave a Comment