如何解决Twilio语音通话不会转到IOS中的自定义页面
我将Twilio用于IOS应用程序中的语音呼叫功能。如果应用程序处于活动状态或在后台运行,则可以完美地转到我的自定义调用页面,我可以从自定义页面采取适当的操作,例如断开连接或其他操作。但是,在处于非活动状态或不在后台运行的情况下,它不会进入自定义呼叫页面,或者无法执行从此处断开的操作。请在这里建议我所缺少的内容
func pushRegistry(_ registry: PKPushRegistry,didReceiveIncomingPushWith payload: PKPushPayload,for type: PKPushType,completion: @escaping () -> Void) {
NSLog("pushRegistry:didReceiveIncomingPushWithPayload:forType:completion:")
// The Voice SDK will use main queue to invoke `cancelledCallInviteReceived:error:` when delegate queue is not passed
if let rootViewController = UIApplication.topViewController() {
let nextViewController = UIStoryboard(name: “Voice”,bundle: nil).instantiateViewController(withIdentifier: “VoiceCallViewController”)
audioDevice = DefaultAudioDevice()
callKitCallController = CXCallController()
audioDevice.isEnabled = false
audioDevice.block()
nextViewController.audioDevice = audioDevice
TwilioVoice.audioDevice = audioDevice
nextViewController.fromAppDelegate = true
nextViewController.callKitProvider = callKitProvider
nextViewController.callKitCallController = callKitCallController
callKitProvider!.setDelegate(nextViewController,queue: nil)
self.pushKitEventDelegate = nextViewController
if let delegate = self.pushKitEventDelegate {
delegate.incomingPushReceived(payload: payload,completion: completion)
rootViewController.navigationController?.pushViewController(nextViewController,animated: true)
}
if let version = Float(UIDevice.current.systemVersion),version >= 13.0 {
/**
* The Voice SDK processes the call notification and returns the call invite synchronously. Report the incoming call to
* CallKit and fulfill the completion before exiting this callback method.
*/
completion()
}
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。