Search code examples
ioscocoa-touchios10core-telephonycallkit

What is analog for CTCallStateIncoming in iOS 10?


Before iOS 10 we can use [[self.call callState] isEqualToString:@"CTCallStateIncoming"] to detect incoming calls. In IOS10 callState deprecated and Replaced by CallKit/CXCall.h properties. But there is no such status like "Incoming" in CallKit, they came up with "outgoing", "onHold", "hasConnected", "hasEnded" statuses. I need Incoming or analog. Any workarounds so far? Thank you for any suggestions.


Solution

  • You should be able to use CallKit's CXCallObserver and CXCall APIs and use the following condition to detect when a given CXCall is incoming (!isOutgoing), has not yet been answered (!hasConnected), and has not ended (!hasEnded):

    !cxCall.isOutgoing && !cxCall.hasConnected && !cxCall.hasEnded