獲取CallKit中的呼叫狀態。您可以在您的應用程序中使用CXCallObserver。
import CallKit
final class ProviderDelegate: NSObject, CXCallObserverDelegate {
var callObserver: CXCallObserver!
func setupCallObserver(){
callObserver = CXCallObserver()
callObserver.setDelegate(self, queue: nil)
}
func callObserver(_ callObserver: CXCallObserver, callChanged call: CXCall) {
if call.hasEnded == true {
print("CXCallState :Disconnected")
}
if call.isOutgoing == true && call.hasConnected == false {
print("CXCallState :Dialing")
}
if call.isOutgoing == false && call.hasConnected == false && call.hasEnded == false {
print("CXCallState :Incoming")
}
if call.hasConnected == true && call.hasEnded == false {
print("CXCallState : Connected")
}
}
}
您是否找到解決方案?我也想知道是否有可能在「正常」呼叫開始或結束時得到回調。 – Jan