![](/img/trans.png)
[英]How do I change the name displayed underneath my app icon on my device's Home screen in iOS?
[英]How do I get the iOS App launch event by clicked icon from home screen?
我的应用程序有很多启动方式,如通用链接,深层链接,远程通知,聚光灯。
当这些函数激活应用程序时,我可以通过application:continueUserActivity:restorationHandler:
的userActivity.activityType
获取事件application:continueUserActivity:restorationHandler:
现在我想通过主屏幕上的点击图标获取iOS App发布活动,我该怎么办?
谢谢
这是默认的启动方案。 其他特殊情况(通知,链接)总是在application:didFinishLaunchingWithOptions:launchOptions
为您提供额外的东西application:didFinishLaunchingWithOptions:launchOptions
来自文档 :
launchOptions
指示应用程序启动原因的字典(如果有)。 在用户直接启动应用程序的情况下,此词典的内容可能为空 。 有关此词典中可能的键以及如何处理它们的信息,请参阅启动选项键。
所以解决方案是检查launchOptions
。 用户直接启动应用程序时,字典为空。
在application:didFinishLaunchingWithOptions:中 ,你得到一个包含launchoptions的字典。 如果此launchOptions字典为nil,则表示使用单击应用程序图标启动应用程序。
此外,如果您的应用程序处于挂起状态,并且单击了应用程序图标,则不会调用didFinishLaunchingWithOptions
,而是调用applicationWillEnterForeground(_ :) 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.