ios - Programmatically make phone call crash in swift 3 -
hello making phone call programmatically. phone number receiving end 61234567890. doesn't comes +. how open call.
self.openappurl(strurl: "tel://\(selectedemployeecontact)") func openappurl(strurl:string) { let myurl=url(string: strurl) let isinstalled=uiapplication.shared.canopenurl(myurl!) if(isinstalled) { if #available(ios 10.0, *) { uiapplication.shared.open(myurl!) } else { uiapplication.shared.openurl(myurl!) } } }
i have list of phone numbers. if number have 10 digits doesn't crash. number crashing. why not handling canopenurl
. how handle properly.
please me.
you can use guard let
prevent crash.
guard let number = url(string: "tel://61234567890") else { return } uiapplication.shared.open(number)
this code working fine more me.
Comments
Post a Comment