skip to Main Content

I am using the following code to make a phone call in my Swift iOS app:

if let phoneNumber = URL(string: "tel://8001968001") { UIApplication.shared.open(phoneNumber) }

I want to know if I need to provide a contact usage description in the Info.plist file for this functionality. I know that a usage description is required for accessing the user’s contacts or address book, but in this case, I am only initiating a phone call using the // URL scheme.

I have already provided the necessary NSAppTransportSecurity settings in the Info.plist file to allow arbitrary loads for the URL scheme. However, I am unsure if a contact usage description is still required. Can someone clarify whether a contact usage description is necessary in this scenario?

Any help or insights would be greatly appreciated. Thank you!

if let phoneNumber = URL(string: "tel://8001968001") { UIApplication.shared.open(phoneNumber) }

2

Answers


  1. you do not need to provide a contact usage description in the Info.plist file. The contact usage description is only required when your app attempts to access the user’s contacts or address book.

    Apple documentation explicitly stating that a contact usage description is not required for the

    tel:// 
    

    URL scheme.

    1. Apple Developer Documentation – Privacy: https://developer.apple.com/documentation/uikit/protecting_the_user_s_privacy
    2. Apple Developer Documentation – Requesting Permission to Access Data: https://developer.apple.com/documentation/uikit/protecting_the_user_s_privacy/requesting_access_to_protected_resources
    Login or Signup to reply.
  2. you can also use this fuction for calling phone number

    func call(phoneNumber:String) {
            
            
            let cleanPhoneNumber = phoneNumber.components(separatedBy: CharacterSet.decimalDigits.inverted).joined(separator: "")
            let urlString:String = "tel://(cleanPhoneNumber)"
            if let phoneCallURL = URL(string: urlString) {
                if (UIApplication.shared.canOpenURL(phoneCallURL)) {
                    UIApplication.shared.open(phoneCallURL, options: [:], completionHandler: nil)
                }
            }
        }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search