当应用收到消息时,我使用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,实际上该应用已被杀死。
我如何获得正确的身份?