有没有办法知道 iOS 中的应用程序何时被删除?

发布于 2024-10-17 09:55:15 字数 524 浏览 7 评论 0原文

我的问题是这样的:

我在 iOS 应用程序上安排了一些 UILocalNotifications,问题是,如果我删除应用程序而不删除与通知关联的对象(并因此从 ScheduledNotifications 数组中删除通知),通知仍然会触发。

虽然我没有经历过它们实际触发(它们设置为在一周的间隔内重复),但自从我在应用程序启动时 NSLog 了 ScheduledNotifications 数组以来,我就有了这方面的证据,即使在删除应用程序并重新安装它之后(使用数据实体)模型消失了),仍然显示一些预定的通知。

我在苹果的参考库中搜索了 UIApplication 和 UIApplicationDelegate 参考,但我发现没有方法知道应用程序是否被删除,如果有,我就写

[[UIApplication sharedApplication] cancelAllLocalNotifications];

在上述方法中。

那么,有没有办法知道这一点呢?

预先感谢您,非常感谢您的帮助。

my problem is this:

I have scheduled some UILocalNotifications on an iOS app, the problem is that if I delete the app without deleting the objects associated with the notifications (and consequently removing the notifications from the scheduledNotifications array) the notifications still fire.

Although I have not experienced them actually firing (they are set to repeat within a week's interval) I have evidence of this since I NSLog the scheduledNotifications array at application launch, which even after deleting the app and reinstalling it (with the entities of the data model gone), still shows some scheduled notifications.

I've searched the UIApplication and the UIApplicationDelegate reference in Apple's reference library but I found no method to know if the app is being deleted, if there is I would just write

[[UIApplication sharedApplication] cancelAllLocalNotifications];

in said method.

So, is there a way for knowing this?

Thank you in advance, your help is very much appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

太阳公公是暖光 2024-10-24 09:55:15

这是 4.0 中的错误,即使用户删除了应用程序,本地通知也会重复,但至少 Apple 在以后的版本中修复了该错误。

This was bug in 4.0 that the local notification was repeated even if the user has deleted the app, but at least that bug was fixed by Apple in later release.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文