我正在開發使用CallKit用於通知用戶的應用程序。但是,我正在使用APN測試應用程序,並且它沒有按照我的預期工作。iOS版 - 無VOIP/FCM PushKit與CallKit
流程應該是: 接收FCM - >使用Callkit創建呼叫 - >用戶接受呼叫 - >執行某些操作。
流量與APP相似,但是我沒有VOIP,我只需要確保呼叫是激活的每次都有一個FCM。
然而,目前,如果應用程序在後臺或無效時,callkit將無法啓動。
我想用PushKit爲實現該的。但是,我沒有經驗,什麼那麼與PushKit(和不知道如果我的應用程序將被禁止或不存在,按照這個帖子:PushKit: Can we use push kit(VoiP Push) in Chat Application without using VoiP
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any],
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
// If you are receiving a notification message while your app is in the background,
// this callback will not be fired till the user taps on the notification launching the application.
// TODO: Handle data of notification
// With swizzling disabled you must let Messaging know about the message, for Analytics
// Messaging.messaging().appDidReceiveMessage(userInfo)
// Print message ID.
if let messageID = userInfo[gcmMessageIDKey] {
print("Message ID: \(messageID)")
}
let aps = userInfo["aps"] as! [String: AnyObject]
// 1
if aps["content-available"] as? Bool == true {
let uuid = UUID(uuidString: MyVariables.uuid)
AppDelegate.shared.displayIncomingCall(uuid: uuid!, handle: "Sanoste", hasVideo: false) { _ in}
}else {
completionHandler(UIBackgroundFetchResult.newData)
}
// Print full message.
print(userInfo)
completionHandler(UIBackgroundFetchResult.newData)
}
上面的代碼是什麼,我使用的是現在的CallKit。
你好,謝謝你的回覆。我昨天測試了VOIP開發證書,一切都按照我的預期工作。然而,你是對的,我們的團隊缺少一個「真實」的Voip後端,而不是使用pushkit來推送通知。我認爲我們的團隊必須再次討論或向Apple尋求幫助。無論如何,再次感謝。 –