我正在使用VOIP应用程序,呼叫通知在前台
和后台
中运行良好,但当我的应用程序处于终止/杀死
状态时,我没有收到任何呼叫通知。
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()
}
}
}
截图
如果您在IOS13+中使用voip通知,则必须使用一种方法“ReportIncomingCall”
provider.reportNewIncomingCall(with: uuid, update: callUpdate){ (error) in
print("New Call reported")
if error == nil {
//Your code here
}
completion?(error)
}