2017-07-31 225 views
0

我正在開發使用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。

回答

1

據我瞭解關於呼叫套件+推動器是爲了獲取應用程序強制用戶退出後才能激活,您需要發送一個特殊的VOIP推送通知是採用在配置你的VoIP推證書developer.apple.com的證書,標識& Profiles部分。

所以從我看到的是你的方法是倒退。您應該使用外部服務器發送voip推送通知,該通知會喚醒您的應用以處理通知...然後執行所需的任何其他處理。

此外,您還需要表明您的應用程序使用的VOIP背景模式。另外值得注意的是,如果你沒有按照預期實際使用VOIP,蘋果很可能會拒絕你從應用商店購買。

+0

你好,謝謝你的回覆。我昨天測試了VOIP開發證書,一切都按照我的預期工作。然而,你是對的,我們的團隊缺少一個「真實」的Voip後端,而不是使用pushkit來推送通知。我認爲我們的團隊必須再次討論或向Apple尋求幫助。無論如何,再次感謝。 –