ABRecordID是一种可靠的方法来识别唯一的联系人? [英] Is ABRecordID a reliable way to identify unique contacts?

查看:165
本文介绍了ABRecordID是一种可靠的方法来识别唯一的联系人?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程式上传了联络人,而且日后需要更新联络人。是否使用 ABRecordID 一种可靠的方法来识别人,或者是否有可能获取新记录以获取已删除记录的ID?

My app uploads contacts, and, in the future, will need to update them. Is using the ABRecordID a reliable way to identify people, or is it possible for a new record to obtain the ID of a deleted record?

要优化上传,我只希望上传自上次上传以来已修改或创建的记录。我目前正在使用核心数据存储该联系人的副本。我想减少我的应用程序的脚印,加快扫描通过人的地址簿执行时间寻找修改/新的联系人,并限制需要上传的金额。在分析一些人的通讯录之后,联系人的数量可以从30到约30,000。处理30,000个联系人是一场噩梦。

To optimize uploads, I would like to upload only the records that have been modified or created since the last upload. I'm currently storing a copy of the person's contacts using core data. I'd like to slim down the footprint of my app and speed up the execution time of scanning through the person's address book looking for modified/new contacts and limit the amount that needs to be uploaded. After analyzing some people's address books, the number of contacts can range from 30 to around 30,000. Dealing with 30,000 contacts is a nightmare.

推荐答案

新记录将不会获取先前与已删除记录相关联的ID。 ABRecordID 在这方面是唯一的。但它们不一定是一致的,一段时间,一些事情可以导致id改变。用户打开或关闭iCloud可能会导致id更改,因为可能从itunes恢复设备。
也就是说, ABRecordID 仍然是您获取联系人唯一ID的最佳选择。你只需要仔细检查,当使用它排队。 Apple建议在地址簿编程指南中提供以下内容:

A new record will not obtain an id previously associated with a deleted record. ABRecordIDs are unique in that regard. But they are not necessarily consistent over time, a couple of things can cause the id to change. The user turning on or off iCloud may cause the id to change, as may restoring the device from itunes. That said, ABRecordID is still your best bet for getting a unique id for a contact. You just need to double check that things line up when using it. Apple suggests the following in the address book programming guide:


建议保留对特定
的长期引用的方法记录是存储第一个和最后一个姓名,或者除了标识符之外的第一个和
姓氏的散列。当您通过
ID查找记录时,将记录的名称与您存储的名称进行比较。如果他们不
匹配,使用存储的名称来查找记录,并存储新的ID
作为记录。

The recommended way to keep a long-term reference to a particular record is to store the first and last name, or a hash of the first and last name, in addition to the identifier. When you look up a record by ID, compare the record’s name to your stored name. If they don’t match, use the stored name to find the record, and store the new ID for the record.

这篇关于ABRecordID是一种可靠的方法来识别唯一的联系人?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆