iOS应用被VOIP唤醒,应用状态错误

时间:2018-09-05 03:37:55

标签: ios swift voip

当应用收到消息时,我使用VOIP唤醒我的应用

func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) {

}

然后将调用applicationDidBecomeActive

func applicationDidBecomeActive(_ application: UIApplication) {
}

我想检测应用是否被杀死,所以我添加以下代码,如

func applicationDidBecomeActive(_ application: UIApplication) {
    if application.applicationState == .background {
        // background
    } else if application.applicationState == .active {
        // active
    } else if application.applicationState == .inactive {
        // inactive
    }
}

但是applicationState始终返回.active,实际上该应用已被杀死。

我如何获得正确的身份?

0 个答案:

没有答案