Last active
August 29, 2015 13:55
-
-
Save alvareztech/8742404 to your computer and use it in GitHub Desktop.
iOS: Call phone direct.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *phNo = @"+919876543210"; | |
NSURL *phoneUrl = [NSURL URLWithString:[NSString stringWithFormat:@"telprompt:%@",phNo]]; // ok tel: | |
if ([[UIApplication sharedApplication] canOpenURL:phoneUrl]) { | |
[[UIApplication sharedApplication] openURL:phoneUrl]; | |
} else { | |
calert = [[UIAlertView alloc]initWithTitle:@"Alert" message:@"Call facility is not available!!!" delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil, nil]; | |
[calert show]; | |
} | |
// The phone number must not contain spaces or square brackets, although it can contain dashes and a leading + sign indicating that the international call prefix should be prepended. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment