获取有关 iPhone 地址簿更改的通知

发布于 2024-09-24 17:27:48 字数 317 浏览 3 评论 0原文

在我的 iPhone 应用程序中,我有 iPhone 地址簿中的联系人集合,其 ABRecordID 通过 Core Data 存储。我想跟踪我的应用程序内外对它们所做的任何更改。目前,在启动时,我会循环遍历我拥有的所有 ABRecordID,检查是否有任何更新。当然,这是极其低效的。

有更好的方法吗?我正在查看 ABAddressBookRegisterExternalChangeCallback,但我想知道这是否会报告在我的应用程序外部进行的更改。例如,如果我退出应用程序,编辑地址簿中的一个或多个联系人,然后重新打开应用程序,我会收到更改通知吗?

任何帮助将非常感激!提前致谢!

In my iPhone app, I have a collection of contacts from the iPhone address book, whose ABRecordIDs are stored via Core Data. I want to keep track of any changes made to them in and out of my app. Currently, on startup, I loop through all the ABRecordIDs I have, checking for any updates. This is horribly inefficient, of course.

Is there a better way to do this? I'm looking at ABAddressBookRegisterExternalChangeCallback, but I'm wondering if this will report changes made outside of my app. For example, if I exit the app, edit one or more contacts in the addressbook, and then reopen the app, will I get a notification of the changes?

Any help would be very much appreciated! Thanks in advance!

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

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

发布评论

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

评论(1

π浅易 2024-10-01 17:27:48

我立即怀疑您会的,只要您的应用程序是后台的。如果它退出(或被杀死),那么您当然不会得到回调。

My immediate suspicion is that you will, provided your app is backgrounded. If it exits (or gets killed), then of course you won't get the callbacks.

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