当我打开导航抽屉应用程序时.ApplicationState应该是Inactive,但在iOS 11中它是Active。
我想通过点击Notification Center中的通知来检测是否已调用application:didReceiveRemoteNotification
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)
}
}
它是iOS 11中的错误还是推送通知的新方法?
检查applicationState的其他方法:
func applicationWillResignActive(_ application: UIApplication) {
var app = application.applicationState
}