获取有关 iPhone 地址簿更改的通知
在我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我立即怀疑您会的,只要您的应用程序是后台的。如果它退出(或被杀死),那么您当然不会得到回调。
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.