在iOS 11上尝试使用tel://方案拨打电话号码时提示 [英] Prompt when trying to dial a phone number using tel:// scheme on iOS 11

查看:631
本文介绍了在iOS 11上尝试使用tel://方案拨打电话号码时提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试使用以下方法从我的iOS应用程序拨打电话时遇到了问题:

I am facing an issue, while trying to start a phone call from my iOS app using:

UIApplication open(_:options: completionHandler:)

在通过两个按钮呼叫与呼叫"开始通话之前,iOS会显示确认弹出窗口/提醒.根据iOS 10中的按钮操作,使用具有true/false的Bool参数调用Cancel和CompletionHandler进行调用.

iOS shows an confirmation popup/alert before starting the call with two button Call & Cancel and CompletionHandler called with a Bool parameter having true/false based on button action in iOS 10.

但是现在在iOS11中,问题在于在点击确认弹出窗口的取消"或呼叫"按钮之前,会自动调用completionHandler,始终具有真实值.

But now in iOS11 the problem is that the completionHandler is being called automatically before tapping on "Cancel" or "Call" button of confirmation popup, always having true value.

这是iOS11中的错误还是我做错了什么?

Is this a bug in iOS11 or is there something that I am doing wrong?

推荐答案

在iOS 11中调用闭包时,行为发生了变化.我无法说是否会恢复这种行为或这是一个错误. 但是,确定用户何时与弹出窗口交互的一种方法是在openURL()的完成闭包中在UIApplicationDidBecomeActive周围添加一个通知侦听器.要确定是否单击了呼叫,您将需要在CTCallCenter上创建另一个自定义通知和侦听器.那是我能够识别它的最好方法,尽管:D

There has been a behavior change in when the closure is called in iOS 11. I cant say if this behavior will be reverted or if this is a bug. But one of the ways you can identify when the user interacted with the popup is by adding a notification listener around UIApplicationDidBecomeActive in the completion closure of openURL(). To identify whether the call was clicked or not you will need to create another custom notification and listener on the CTCallCenter. That was the best way through which I was able to identify it, there might be better solutions though :D

这篇关于在iOS 11上尝试使用tel://方案拨打电话号码时提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆