簡體   English   中英

當應用程序在 iOS 14 中終止或終止時,未收到 Voip 通知

[英]Voip notification did not receive when app kill or terminated in iOS 14

在我的應用程序中,它是 VoIP 通話的現有功能。 一些用戶向我報告說沒有收到 VoIP 電話。 我檢查后發現報告的用戶版本是 ios 13 或更高版本。

但是我的一個朋友有 iPhone 6 plus (ios 12.5),因為我收到了 VoIP 電話。

ios 13 或更高版本仍有任何設置。

這是我的代碼:

func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) {
let provider1 = CXProvider(configuration: defaultConfig())
          provider1.setDelegate(self, queue: nil)
           let update = CXCallUpdate()
           update.supportsDTMF = true
           update.supportsHolding = true
           update.supportsGrouping = false
           update.supportsUngrouping = false
           update.hasVideo = false
  //  self.provider = provider1
           let bgTaskID = UIApplication.shared.beginBackgroundTask(expirationHandler: nil)
           DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()) {
           UIApplication.shared.endBackgroundTask(bgTaskID)
           }
          uuidneww = UUID()
           update.remoteHandle = CXHandle(type: .generic, value: "Calling")
    provider1.reportNewIncomingCall(with:uuidneww , update: update, completion: { error in })
}

iOS 15:

如果在前台/后台有推送,但在終止的 state 中沒有推送,並且您觸發 CallKit API,請確保:

  1. PKPushRegistry object 在application(didFinishLaunchingWithOptions:)中創建。 這一步非常重要,因為您可以在某個視圖 controller 中創建它,當然它不會在后台調用。
  2. delegate已設置
  3. pushRegistry:didReceiveIncomingPushWithPayload:forType:withCompletionHandler:委托方法被調用。 確保使用帶有完成塊的方法,因此它仍然有效,但將來可能不會

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM