Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/95.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios CTCallCenter callEventHandler从未被调用_Ios_Iphone_Core Telephony_Ios 9 Beta3 - Fatal编程技术网

Ios CTCallCenter callEventHandler从未被调用

Ios CTCallCenter callEventHandler从未被调用,ios,iphone,core-telephony,ios-9-beta3,Ios,Iphone,Core Telephony,Ios 9 Beta3,我尝试使用CTCallCenter接收来自iPhone的来电。当应用程序处于活动状态时,我调用设备,但并没有发生任何事情,所以不会调用调用EventHandler 原因是什么 我使用安装在iphone5和XCode7上的IOS9.0beta3 我的代码: - (void)viewDidLoad { [super viewDidLoad]; CTCallCenter *callCenter = [[CTCallCenter alloc] init]; callCenter.callEventHa

我尝试使用CTCallCenter接收来自iPhone的来电。当应用程序处于活动状态时,我调用设备,但并没有发生任何事情,所以不会调用调用EventHandler

原因是什么

我使用安装在iphone5和XCode7上的IOS9.0beta3

我的代码:

- (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"];
    }
  };
}

我已经解决了这个问题,CTCallCenter*呼叫中心应该在ViewController中定义为属性:我发现在iOS 9.3.5上没有调用callEventHandler。