提问者:小点点

如何在使用VOIP终止应用时获得呼叫通知


我正在使用VOIP应用程序,呼叫通知在前台后台中运行良好,但当我的应用程序处于终止/杀死状态时,我没有收到任何呼叫通知。

  • DidReceiveIncomingPushWith
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()
                    

                }
                
            }
    }

截图


共1个答案

匿名用户

如果您在IOS13+中使用voip通知,则必须使用一种方法“ReportIncomingCall”

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