#if WFCU_SUPPORT_VOIP
PKPushRegistry *voipRegistry = [[PKPushRegistry alloc] initWithQueue:dispatch_get_main_queue()];
voipRegistry.delegate = self;
// Set the push type to VoIP
voipRegistry.desiredPushTypes = [NSSet setWithObject:PKPushTypeVoIP];
#endif
程序启动就崩溃,根据崩溃日志,问题在 PushKit:_assertIfCallKitNotLinked 表明 PushKit 需要 CallKit 但未链接。查找项目中的 PushKit 使用位置:
#if WFCU_SUPPORT_VOIP
#if USE_CALL_KIT
// iOS 13+ 要求:使用 VoIP 推送必须链接 CallKit 框架
// 如果 USE_CALL_KIT 未启用,不要注册 VoIP 推送类型,否则会崩溃
PKPushRegistry *voipRegistry = [[PKPushRegistry alloc] initWithQueue:dispatch_get_main_queue()];
voipRegistry.delegate = self;
// Set the push type to VoIP
voipRegistry.desiredPushTypes = [NSSet setWithObject:PKPushTypeVoIP];
#endif
#endif