這是我的代碼打個電話什麼是錯誤的,我的功能來撥打電話
let phoneCall = phoneNumberTF.text
if let phoneCall = phoneCall {
let url = NSURL(string: "tel://\(phoneCall)")
UIApplication.sharedApplication().openURL(url!)
}else {
let alert = UIAlertController(title: "Error", message: "not correct phone", preferredStyle: .Alert)
let action = UIAlertAction(title: "Retry", style: .Default, handler: nil)
alert.addAction(action)
}
我得到這個錯誤日誌中
ERROR: There is no registered handler for URL scheme tel
暗示:我已經檢查這個問題,但解決方案並沒有跟我 Calling a phone number in swift
您是在真實設備上測試嗎?您無法在模擬器中撥打電話。 – rmaddy
順便說一句 - 你應該檢查'openURL'的結果。 – rmaddy
@rmaddy哦,我真的不能打開打電話的控制器? –