我在 iOS 10 中用 CXCallObserver 更改了 CTCallCenter。
这是我的代码:
#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");
}
}
但我无法获得语音通话事件,并且收到如下警告:
Sending 'HomeViewController *const __strong' to parameter of incompatible type 'id<CXCallObserverDelegate> _Nullable
请帮我。