Dial a phone number with an access code programmatically in iOS

Shahid Aslam picture Shahid Aslam · Mar 28, 2011 · Viewed 69.9k times · Source

How can I dial a phone number that includes a number and access code programmatically in iOS?

For example:

number: 900-3440-567
Access Code: 65445

Answer

vijay adhikari picture vijay adhikari · Mar 28, 2011
UIDevice *device = [UIDevice currentDevice];
if ([[device model] isEqualToString:@"iPhone"] ) {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:130-032-2837"]]];
} else {
    UIAlertView *notPermitted=[[UIAlertView alloc] initWithTitle:@"Alert" message:@"Your device doesn't support this feature." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [notPermitted show];
    [notPermitted release];
}