gpt4 book ai didi

ios - 如何通过应用程序扩展 (iWatch) 取消预定的本地通知(在 iPhone 上)

转载 作者:行者123 更新时间:2023-11-30 11:11:23 25 4
gpt4 key购买 nike

我想通过应用程序扩展(iWatch - watchOS)取消在主应用程序目标(iPhone)中安排的重复本地通知。当我尝试像 iWatch 扩展中的 UNUserNotificationCenter.current().removeAllPendingNotificationRequests() 那样取消它时,它对主目标发出的请求没有影响。有可能以某种方式完成吗?

最佳答案

好的,如果 iPhone 和 Watch 应用程序“共享”UNUserNotificationCenter 实例,则这是可能的。但他们没有。每个目标都有单独的实例,因此您无法取消从其他设备安排的本地安排的用户通知。

您可以在以下位置阅读有关用户通知和所有功能的更多详细信息:http://martiancraft.com/blog/2018/02/notification-handling-on-watchkit/ ,MartianCraft 首席工程师 Eric Blair 的博客

关于ios - 如何通过应用程序扩展 (iWatch) 取消预定的本地通知(在 iPhone 上),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52151221/

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