CTCallCenter - 呼叫事件处理程序 - 处于后台状态 [英] CTCallCenter - Call Event Handler - in background state

查看:20
本文介绍了CTCallCenter - 呼叫事件处理程序 - 处于后台状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于 Apple 文档,在应用暂停时无法处理手机状态:https://developer.apple.com/documentation/coretelephony/ctcallcenter

Regarding the Apple documentation there is no way to handle the phone state while the app is suspended: https://developer.apple.com/documentation/coretelephony/ctcallcenter

当它被挂起时,您的应用程序不会收到调用事件"

"While it is suspended, your application does not receive call events"

背景"状态也是如此吗?(因为关于 Apple 文档中描述的状态,背景状态与暂停"应用状态不同)

Is this also true for the "background" state? (As the background state is not the same with the "suspended" app state regarding the states described in the Apple documentation)

https://web.archive.org/web/20140824215114/https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html

我正在使用以下代码处理手机状态:

I'm handling the phone state using the following code:

CTCallCenter *callCenter = [[CTCallCenter alloc] init];

callCenter.callEventHandler=^(CTCall* call)
{

  //call state

};

我已在 callEventHandler 块中添加了一个本地通知,以检查当我的应用程序处于后台状态时是否会收到呼叫事件,但是否接缝未执行该块(我的应用程序具有后台支持并且全部收到当应用程序在后台时,事件(通过 TCP)被正确处理)

I have added a local notifications into the callEventHandler block in order to check if a call events will be received while my app is in background state but is seams that the block is not executed ( my app has a background support and all received events (via TCP) are handled correctly while the app is in background )

推荐答案

当应用程序处于后台时,我使用 callEventHandler 完成的所有测试都无法接收.但是,当应用程序处于前台时,一切正常.

All tests that I've done I can't receive any using callEventHandler when the application is in background. But, when the application is in foreground, all nicely work.

套接字有效,因为 iOS 会为您的应用处理它并相应地交付包.但为此,您需要创建一个 voip 套接字并将 voip 添加到 UIBackgroundModes 到您的 App-Info.plist.

The socket works, because iOS handles it for you app and deliver the packtes accordingly. But for that, you need to create a voip socket and add voip to UIBackgroundModes to your App-Info.plist.

这篇关于CTCallCenter - 呼叫事件处理程序 - 处于后台状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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