Objective C
NSString *phNo = @"999991";
NSURL *phoneUrl = [NSURL URLWithString:[NSString stringWithFormat:@"telprompt://%@",phNo]];
if ([[UIApplication sharedApplication] canOpenURL:phoneUrl]) {
[[UIApplication sharedApplication] openURL:phoneUrl];
}
else{
// Show alert Call facility is not available in this Device!!
}
Swift 3.0
/// Telephone call by number func telephoneCall(number: String) { let trimmed = number.replacingOccurrences(of: " ", with: "") let phoneURL: URL = URL(string: "telprompt://\(trimmed)")! // Removed white space if UIApplication.shared.canOpenURL(phoneURL) { if #available(iOS 10.0, *) { UIApplication.shared.open(phoneURL, options: [:], completionHandler: nil) } else { UIApplication.shared.openURL(phoneURL) } } else { // Call facility is not available on your device } }
– How to make an iOS App
ktrkathir