我遇到了有史以来最奇怪的错误,我正在我的 iPhone 上运行该应用程序,并且我有以下代码:
self.callCenter = [[CTCallCenter alloc] init];
    [self.callCenter setCallEventHandler: ^(CTCall* call) {
        if ([call.callState isEqualToString: CTCallStateDisconnected]) {
            NSLog(@"call ended");
            dispatch_sync(dispatch_get_main_queue(), ^(void) {
                NSLog(@"on main thread!");
                NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
                [userInfo setValue:weakSelf.recordRef forKey:kContactKey];
                [[NSNotificationCenter defaultCenter] postNotificationName:kCallEndedNotification object:nil userInfo:userInfo];
            });
        }
    }];
由于某种原因,没有调用此代码块。但是如果我在 if 语句上放了一个断点,它就会被调用。知道为什么会发生这种情况吗?