1

我使用以下代码来获取通话状态:

CTCallCenter *callCenter = [[CTCallCenter alloc] init];
    callCenter.callEventHandler = ^(CTCall* call)
    {
        if (call.callState == CTCallStateDisconnected)
        {
            NSLog(@"Call has been disconnected");
        }
        else if (call.callState == CTCallStateConnected)
        {
            NSLog(@"Call has just been connected");
        }
        else if(call.callState == CTCallStateDialing)
        {
            NSLog(@"Call is dialing");
        }
        else
        {
            NSLog(@"None of the conditions");   
        }
    };

但是我经常丢失CTCallStateConnected,我打印CTCall,发现正常的CTCall的地址不一样,不知道为什么,如何才能保持正常。

CTCall 日志如下:

// normal:
CTCall: CTCall (0x11f42e0) {
    callState: [CTCallStateDialing]
    Call ID: [A8E6FB15-C90A-4610-8F61-C762C82F88F7]
}
CTCall: CTCall (0x1196ab0) {
    callState: [CTCallStateConnected]
    Call ID: [A8E6FB15-C90A-4610-8F61-C762C82F88F7]
}
CTCall (0x1185540) {
    callState: [CTCallStateDisconnected]
    Call ID: [A8E6FB15-C90A-4610-8F61-C762C82F88F7]
}

// lose CTCallStateConnected
CTCall (0x65aa50) {
    callState: [CTCallStateDialing]
    Call ID: [C695644F-0A04-4BEB-BBB6-EBFB95B654F3]
}
CTCall (0x65aa50) {
    callState: [CTCallStateDisconnected]
    Call ID: [C695644F-0A04-4BEB-BBB6-EBFB95B654F3]
}
4

0 回答 0