我想区分一下如果应用程序becameActive响应RemoteNotification点击。如何做到这一点?
发布于 2016-11-09 20:11:52
你可以像这样检查它
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSDictionary *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (notification) {
// it's launch from notification
}
else
{
// normal launch on app icon click
}
}为了快速,请使用下面的代码
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
if (launchOptions?[UIApplicationLaunchOptionsKey.remoteNotification] as? NSDictionary) != nil {
// it's launch from notification
}
else
{
// normal launch on app icon click
}
// Override point for customization after application launch.
return true
}https://stackoverflow.com/questions/40506636
复制相似问题