我正在尝试获取呼叫事件(收到呼叫、呼叫结束等) 我尝试运行 CoreTelephonyDemo 的示例代码,但我没有收到任何呼叫事件。任何人都可以指导我。
我在 applicationWillResignActive 中尝试了此代码,但没有收到任何事件。我错过了什么或做错了什么吗?请指导。
- (void)applicationWillResignActive:(UIApplication *)application
{
CTCallCenter *callCenter1 = [[CTCallCenter alloc] init];
callCenter1.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 == CTCallStateConnected)
{
NSLog(@"Call is incoming");
}
else
{
NSLog(@"None of the conditions");
}
};
}