更新时间:2022-11-25 14:51:16
输入代码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UILocalNotification * notification = launchOptions [UIApplicationLaunchOptionsLocalNotificationKey] ;
if(notification){
//从通知启动
} else {
//从跳板
}
}
在 UIApplicationDelegate
。 p>
I would like to know if there is a way to know if an app (which can be closed or open in background) has been launched with a click on:
Thanks !!
put this code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UILocalNotification *notification = launchOptions[UIApplicationLaunchOptionsLocalNotificationKey];
if (notification) {
// launched from notification
} else {
// from the springboard
}
}
in your UIApplicationDelegate
.