0
我想区分应用程序是否成为激活以响应RemoteNotification点击。怎么做 ?检查是否由于RemoteNotification而使应用程序变为活动状态(应用程序已启动)
我想区分应用程序是否成为激活以响应RemoteNotification点击。怎么做 ?检查是否由于RemoteNotification而使应用程序变为活动状态(应用程序已启动)
您可以检查它像这样
- (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
}
}
的迅速PLZ使用本
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
}