在以编程方式拨打电话后触发事件

时间:2018-02-14 20:22:34

标签: ios swift

我有一个iOS程序,以编程方式让用户拨打电话。

我想在用户的电话结束时显示一个弹出窗口询问问题(并且用户会自动回到他们拨打电话的应用中)。

在swift中建议的方法是什么?

以下是当前代码:

    @IBAction func makePhoneCall(_ sender: UIButton) {
        let phone = getPhone().filter(characterOkay)
        if let url = URL(string: "tel://\(phone)"), UIApplication.shared.canOpenURL(url) {
            if #available(iOS 10, *) {
                UIApplication.shared.open(url)
            } else {
                UIApplication.shared.openURL(url)
            }
        }

        // This incorrectly shows the popup before the phone call. 
        showQuestionPrompt();
    }

0 个答案:

没有答案
相关问题