Make a phone call from your mobile app

Make a phone call from your mobile app

This tutorial will cover how to make a phone call directly from your mobile app by deep linking to the native phone app. It will also contain a validation for removing special characters because this approach allows only numbers to be entered.


    let stringArray = phoneString.componentsSeparatedByCharactersInSet(
        let phoneNumber = stringArray.joinWithSeparator("")
            if let url = NSURL(string: "tel://\(phoneNumber)") {

Objective – C

  NSString *phNo = [[phoneString componentsSeparatedByCharactersInSet:
                [[NSCharacterSet decimalDigitCharacterSet] invertedSet]] 
NSURL *phoneUrl = [NSURL URLWithString:[NSString  stringWithFormat:@"tel:%@",phNo]];
    if ([[UIApplication sharedApplication] canOpenURL:phoneUrl]) {
        [[UIApplication sharedApplication] openURL:phoneUrl];

If you want to prompt the user before making the call using the following code telprompt:

Leave a Reply

Your email address will not be published. Required fields are marked *