I'm trying to detect call states on iOS 10. I have tested this on iOS 9.3 and it works fine. But on iOS 10, CTCallCenter is deprecated, so I used Callkit.
I can't detect the call state. I can't find any correct answers.
My code is:
@property (nonatomic, strong) CXCallObserver *callObserver;
...
self.callObserver = [[CXCallObserver alloc] init];
[callObserver setDelegate:self queue:nil];
...
- (void)callObserver:(CXCallObserver *)callObserver callChanged:(CXCall *)call {
if (call.hasConnected) {
NSLog(@"connected/n");
// perform necessary actions
} else if(call.hasEnded) {
NSLog(@"disconnected/n");
}
}