我CTCallCenter在我的项目中使用。现在已弃用,我想知道什么是替代品?如何获取语音通话事件?
CTCallCenter
这没有很好的文档记录,但是我在CTCallCenter公共头文件中找到了此提及:
“替换为<CallKit/CXCallObserver.h>”
<CallKit/CXCallObserver.h>
因此,从iOS 10开始,您应该使用CXCallObserver新CallKit框架类来检索有关活动调用的信息:
CXCallObserver
CallKit
CXCallObserver *callObserver = [[CXCallObserver alloc] init];
提供CXCallObserverDelegate您要在其上执行委托回调的符合协议和队列的对象:
CXCallObserverDelegate
// If queue is nil, then callbacks will be performed on main queue [callObserver setDelegate:self queue:nil]; // Don't forget to store reference to callObserver, to prevent it from being released self.callObserver = callObserver;
并在委托对象上实现以下方法:
- (void)callObserver:(CXCallObserver *)callObserver callChanged:(CXCall *)call { if (call.hasConnected) { // perform necessary actions } }
有关更多信息,您可以检查: