Post

Replies

Boosts

Views

Activity

LiveCommunicationKit problem
Code: func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) { print("📶 收到 VoIP 推送: (payload.dictionaryPayload)") JPUSHService.handleVoipNotification(payload.dictionaryPayload) // 解析来电信息 guard let voipInfo = payload.dictionaryPayload["_j_voip"] as? [String: Any] else { completion() return } let caller = voipInfo["relationship"] as? String ?? "未知来电" apiUserId = "\(voipInfo["apiUserId"] ?? "")" let callUUID = UUID() // 关键:直接调用 reportIncomingCall // 虽然 Task 是异步的,但我们已经用 @preconcurrency 标记了类 // 并且 PushKit 的 completion 会在之后立即调用 self.reportIncomingCall(uuid: callUUID, callerName: caller) // 立即调用 PushKit completion completion() } private func reportIncomingCall(uuid: UUID, callerName: String) { print("========来电了============="); currentCallUUID = uuid isCallNotAnswered = true let handle = Handle( type: .generic, value: callerName, displayName: callerName ) var update = Conversation.Update( localMember: handle, members: [handle], activeRemoteMembers: [handle] ) // 👇 关键:设置通话能力为支持视频和播放铃声 update.capabilities = [.video, .playingTones] // ✅ 修复数据竞争警告 Task { do { try await conversationManager.reportNewIncomingConversation(uuid: uuid, update: update) print("✅ LiveCommunicationKit 来电上报成功") } catch { print("❌ 来电上报失败: \(error.localizedDescription)") } } } When the app is in the background and VoIP messages arrive, the program crashes. The error message is:*** Assertion failure in -[PKPushRegistry _terminateAppIfThereAreUnhandledVoIPPushes], PKPushRegistry.m:349 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Killing app because it never posted an incoming call to the system after receiving a PushKit VoIP push.' *** First throw call stack: (0x18df82044 0x18b419abc 0x18d27d6d0 0x21cff5494 0x107486064 0x10747d19c 0x21cff46fc 0x10746c584 0x107486064 0x1074a6f98 0x10747c548 0x10747c484 0x18ded4b74 0x18de782c4 0x18de79a0c 0x1dad01454 0x1908991a4 0x190864a28 0x10435fa1c 0x1b4965f08) libc++abi: terminating due to uncaught exception of type NSException Debug session ended with code 9: Terminated due to signal 9
0
0
38
15h
LiveCommunicationKit problem
Code: func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) { print("📶 收到 VoIP 推送: (payload.dictionaryPayload)") JPUSHService.handleVoipNotification(payload.dictionaryPayload) // 解析来电信息 guard let voipInfo = payload.dictionaryPayload["_j_voip"] as? [String: Any] else { completion() return } let caller = voipInfo["relationship"] as? String ?? "未知来电" apiUserId = "\(voipInfo["apiUserId"] ?? "")" let callUUID = UUID() // 关键:直接调用 reportIncomingCall // 虽然 Task 是异步的,但我们已经用 @preconcurrency 标记了类 // 并且 PushKit 的 completion 会在之后立即调用 self.reportIncomingCall(uuid: callUUID, callerName: caller) // 立即调用 PushKit completion completion() } private func reportIncomingCall(uuid: UUID, callerName: String) { print("========来电了============="); currentCallUUID = uuid isCallNotAnswered = true let handle = Handle( type: .generic, value: callerName, displayName: callerName ) var update = Conversation.Update( localMember: handle, members: [handle], activeRemoteMembers: [handle] ) // 👇 关键:设置通话能力为支持视频和播放铃声 update.capabilities = [.video, .playingTones] // ✅ 修复数据竞争警告 Task { do { try await conversationManager.reportNewIncomingConversation(uuid: uuid, update: update) print("✅ LiveCommunicationKit 来电上报成功") } catch { print("❌ 来电上报失败: \(error.localizedDescription)") } } } When the app is in the background and VoIP messages arrive, the program crashes. The error message is:*** Assertion failure in -[PKPushRegistry _terminateAppIfThereAreUnhandledVoIPPushes], PKPushRegistry.m:349 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Killing app because it never posted an incoming call to the system after receiving a PushKit VoIP push.' *** First throw call stack: (0x18df82044 0x18b419abc 0x18d27d6d0 0x21cff5494 0x107486064 0x10747d19c 0x21cff46fc 0x10746c584 0x107486064 0x1074a6f98 0x10747c548 0x10747c484 0x18ded4b74 0x18de782c4 0x18de79a0c 0x1dad01454 0x1908991a4 0x190864a28 0x10435fa1c 0x1b4965f08) libc++abi: terminating due to uncaught exception of type NSException Debug session ended with code 9: Terminated due to signal 9
Replies
0
Boosts
0
Views
38
Activity
15h