gpt4 book ai didi

javascript - 当用户在应用程序图标上键入时如何触发一些代码?

转载 作者:行者123 更新时间:2023-11-29 02:50:43 24 4
gpt4 key购买 nike

默认情况下,远程通知仅在用户单击其中之一时才会执行。

但是,当用户单击应用程序图标时,即使红色“角标(Badge)”的存在增加,也不会考虑通知,如文档所示:

If the application icon is tapped on a device running iOS, the application calls the same method, but furnishes no information about the notification.

在 Javascript 端使用 Cordova/PhoneGap(不直接使用 Objective-C),是否可以设置一个回调来在用户点击时触发一些代码(例如数据刷新)在应用程序的图标上?我阅读了文档,但找不到类似的内容。

否则我会向用户提供过时的数据......

最佳答案

如果你看一下Launch option keys您会找到一个 UIApplicationLaunchOptionsRemoteNotificationKey:

UIApplicationLaunchOptionsRemoteNotificationKey The presence of this key indicates that a remote notification is available for the app to process. The value of this key is an NSDictionary containing the payload of the remote notification. See the description of application:didReceiveRemoteNotification: for further information about handling remote notifications. This key is also used to access the same value in the userInfo dictionary of the notification named UIApplicationDidFinishLaunchingNotification.

关于javascript - 当用户在应用程序图标上键入时如何触发一些代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24577060/

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