iOS 10:如何使用CallKit/CXCallObserver获得通话事件? [英] iOS 10 : How can I get a call event using CallKit/CXCallObserver?
本文介绍了iOS 10:如何使用CallKit/CXCallObserver获得通话事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在iOS 10中使用CXCallObserver更改了CTCallCenter.
I changed the CTCallCenter with CXCallObserver in iOS 10.
这是我的代码:
#import <CallKit/CXCallObserver.h>
#import <CallKit/CXCall.h>
-(void)viewDidLoad {
CXCallObserver *callObserver = [[CXCallObserver alloc] init];
[callObserver setDelegate:self queue:nil];
... ...
}
- (void)callObserver:(CXCallObserver *)callObserver callChanged:(CXCall *)call {
if (call.hasConnected) {
NSLog(@"********** voice call connected **********/n");
} else if(call.hasEnded) {
NSLog(@"********** voice call disconnected **********/n");
}
}
但是我无法收到语音通话事件,并且得到了这样的警告:
But I can't get a voice call event and I got a warning like this:
Sending 'HomeViewController *const __strong' to parameter of incompatible type 'id<CXCallObserverDelegate> _Nullable
请帮助我.
推荐答案
您错过了CXCallObserverDelegate.
You missed the CXCallObserverDelegate.
@interface HomeViewController : UIViewController <CXCallObserverDelegate>
@end
然后,警告将消失,并且您会收到语音呼叫事件.希望对您有帮助.
Then the warning will disappear and you get a voice call event. I hope this help you.
这篇关于iOS 10:如何使用CallKit/CXCallObserver获得通话事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文