【问题标题】:Add function for cancel in UIAlert of Phone Call function在电话功能的 UIAlert 中添加取消功能
【发布时间】:2017-06-30 18:44:08
【问题描述】:

我有一个功能可以在按下按钮时拨打电话。

private func callNumber(phoneNumber:String) {

  if let phoneCallURL = URL(string: "tel://\(phoneNumber)") {

    let application:UIApplication = UIApplication.shared
      if (application.canOpenURL(phoneCallURL)) {
          application.open(phoneCallURL, options: [:], completionHandler: nil)
        }
    }
}

如果用户在弹出警报以确认呼叫时点击取消,我想添加一些功能。我该怎么做?

【问题讨论】:

标签: ios iphone swift xcode


【解决方案1】:

根据这个问题:Prompt when trying to dial a phone number using tel:// scheme on iOS 10.3

此警报实际上是 iOS 10.3 中的一个错误,应该在将来的某个时候删除。它不应该出现在本机应用程序中的“tel:”链接。

也就是说,我认为没有办法检测警报以及用户如何与之交互。

【讨论】:

  • 啊,好的。谢谢!我觉得奇怪的是我无法控制 UIAlert,但不确定文档中是否有我遗漏的内容。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-02-22
  • 2019-01-22
  • 2020-05-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多