检测到应用程序是在通知中心或通过他的Icon从后台返回时重新打开的? UIApplicationStateBackground

时间:2016-02-11 18:46:10

标签: ios objective-c swift apple-push-notifications appdelegate

我想要一个帮助,是否有任何方法可以通过Notification Center或通过他的Icon从后台返回来检测应用重新打开UIApplicationStateBackground

当应用关闭时,我可以通过launchoptions

中的didFinishLaunchingWithOptions看到差异
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    NSDictionary *pushNotification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];

        if (pushNotification) {
        //Tapped Notification when app is inactive
        }
}

但是,当应用程序来自后台时,我不知道他们是否触摸了应用程序图标或通知。

1 个答案:

答案 0 :(得分:1)

检查application:didFinishLaunchingWithOptions:中的options对象。检查密钥的描述为here