这是我的代码打个电话什么是错误的,我的功能来拨打电话
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哦,我真的不能打开打电话的控制器? –