使用CTCallCenter时丢失CTCallStateConnected

时间:2013-05-25 01:54:05

标签: ios objective-c-blocks

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

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]
}

0 个答案:

没有答案