3

我尝试使用 CTCallCenter 接收来自 iPhone 的来电。当应用程序处于活动状态时,我调用设备并且没有任何反应 callEventHandler 未被调用。

可能是什么原因?

我使用安装在 iPhone 5 和 XCode7 上的 IOS9.0 beta3。

我的代码:

- (void)viewDidLoad {
[super viewDidLoad];

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

0 回答 0