gpt4 book ai didi

iOS/X代码 : how to know that app has been launched with a click on notification or on springboard app icon?

转载 作者:可可西里 更新时间:2023-11-01 03:26:44 24 4
gpt4 key购买 nike

我想知道是否有一种方法可以知道某个应用程序(可以在后台关闭或打开)是否已通过单击启动:

  • 通知(在通知中心)?
  • 还是跳板上的应用程序图标?

谢谢!!

最佳答案

把这段代码:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UILocalNotification *notification = launchOptions[UIApplicationLaunchOptionsLocalNotificationKey];

if (notification) {
// launched from notification
} else {
// from the springboard
}
}

在你的UIApplicationDelegate .

关于iOS/X代码 : how to know that app has been launched with a click on notification or on springboard app icon?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12937359/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com