使用 VOIP 杀死应用程序时如何获取呼叫通知

时间:2021-03-30 12:30:08

标签: ios swift notifications voip

我正在使用 VOIP 应用程序,呼叫通知在 backgroundTerminated/killed 中工作正常,但是当我的应用程序处于 func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) { print("payload is--->\(payload.dictionaryPayload)") var strtypeofNotification : String = "" let dictpayload = payload.dictionaryPayload as NSDictionary let aps_dict = dictpayload["aps"] as? NSDictionary let dict_body = aps_dict?["alert"] as? NSDictionary let str_status = dict_body?["status"] as? String let str_body = dict_body?["body"] as? String let str_title = dict_body?["title"] as? String LinphoneManager.instance()?.startLinphoneCore_second() if Constants.isLogin == "1" { let arr = str_body?.components(separatedBy: ",") as! NSArray let str_source = arr[0] as? String let arr_source = str_source?.components(separatedBy: ":") as! NSArray str_source_value = arr_source[1] as! String if UIApplication.shared.applicationState == .active { strtypeofNotification = "Call" } else { // let call = aVoipManager.getCall() } } } 状态时,我'我没有收到任何关于呼叫的通知。

  • didReceiveIncomingPushWith
{{1}}

Screenshot

1 个答案:

答案 0 :(得分:0)

如果您在 ios 13+ 中使用 voip 通知,那么您必须使用一种方法“ReportIncomingcall”

provider.reportNewIncomingCall(with: uuid, update: callUpdate){ (error) in
          print("New Call reported")
          if error == nil {
                //Your code here
          }
          completion?(error)
          
      }