name ended robotically after 2-3 seconds when obtain a voip notification within the terminated case
and that is my code:-
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for sort: PKPushType, completion: @escaping () -> Void) {
guard sort == .voIP else { return }
let typeStr = payload.dictionaryPayload["type"] as? String ?? ""
if typeStr == "call_audio" {
print("PushKit - didReceiveIncomingPushWith: (payload.dictionaryPayload)")
let uuidStr = payload.dictionaryPayload["uuid"] as? String ?? ""
let id = payload.dictionaryPayload["id"] as? String ?? ""
let nameCaller = payload.dictionaryPayload["callerName"] as? String ?? ""
let deal with = payload.dictionaryPayload["handle"] as? String ?? ""
let knowledge = flutter_callkit_incoming.Knowledge(id: uuidStr, nameCaller: nameCaller, deal with: "Incoming Name",sort: 0)
knowledge.further = ["platform": "ios", "type":type, "uuid": id, "callerName": nameCaller, "handle": handle, "isVideo": false,"id": id]
knowledge.appName="Randomly"
knowledge.uuid=uuidStr
knowledge.nameCaller=nameCaller
knowledge.length=60000
knowledge.sort=0
knowledge.handleType="electronic mail"
knowledge.supportsDTMF=false
knowledge.supportsGrouping=false
knowledge.audioSessionMode="voiceChat"
knowledge.audioSessionPreferredSampleRate=44100
knowledge.audioSessionPreferredIOBufferDuration=0.005
knowledge.audioSessionActive=true
knowledge.maximumCallsPerCallGroup=1
knowledge.supportsHolding=false
knowledge.supportsUngrouping=false
knowledge.maximumCallGroups=1
SwiftFlutterCallkitIncomingPlugin.sharedInstance?.showCallkitIncoming(knowledge, fromPushKit: true)
DispatchQueue.primary.asyncAfter(deadline: .now() + 1) {
completion()
}
}
else if typeStr == "missed_call" {
SwiftFlutterCallkitIncomingPlugin.sharedInstance?.endAllCalls()
completion()
}
}
after I shut the app (be terminated) the difficulty occurred and if I obtain one other name it will work as anticipated so this challenge occurred in first time I obtain name after being terminated that the decision ended instantly after 2-3 sec how can I clear up this?