Dock or control center does not make application inactive

269 Views Asked by At

When I open navigation drawer application.ApplicationState should be Inactive but in iOS 11 it is Active.

I want to detect if application: didReceiveRemoteNotification was called by tapping on a notification in Notification Center

func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {

    let state : UIApplicationState = application.applicationState
    if (state == .Inactive || state == .Background) {
        // go to screen relevant to Notification content
    } else {
        // App is in UIApplicationStateActive (running in foreground)
    }
}

Is it a bug in iOS 11 or is there new approach with Push Notifications?

Other way to check applicationState:

func applicationWillResignActive(_ application: UIApplication) {
    var app = application.applicationState
}
0

There are 0 best solutions below