iOS 8-在应用未激活时显示来电(无CallKit)

时间:2018-09-09 11:28:22

标签: ios background ios8 voip pushkit

我使用PushKit / VoIP收到了来电请求。问题是我无法启动应用程序以显示来电屏幕,因为在iOS 10之前CallKit不可用。 我已成功显示通知,但如何从后台启动该应用程序?

这是我的代码:

 func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, for type: PKPushType) {
    if (pushCredentials.type == .voIP) {
        let pkToken = (pushCredentials.token as NSData).description
        SocketManager.shared.send(pkToken: pkToken)
    }
}


func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) {
    let payloadDict = payload.dictionaryPayload["aps"] as? Dictionary<String, String>
    let message = payloadDict?["alert"]


    Notifications.present(id: "test", title: "test", body: message)
    NSLog("incoming voip notfication 1: \(payload.dictionaryPayload)")
}

0 个答案:

没有答案