[英]ABRecordGetRecordID returns -1
I am trying to get the ABRecordID of a record, but it always returns -1. 我试图获取记录的ABRecordID,但它总是返回-1。 Here is my code:
这是我的代码:
NSNumber *recordId = [NSNumber numberWithInteger:ABRecordGetRecordID(person)];
I can retrieve other informations without any problems :/ Any solutions? 我可以毫无问题地检索其他信息:/任何解决方案?
You need to request authorization ( ABAddressBookRequestAccessWithCompletion
) to be able to get a record identifier. 您需要请求授权(
ABAddressBookRequestAccessWithCompletion
)才能获取记录标识符。 Otherwise you just get an ABPersonRef
with a copy of the data. 否则,您只需获得带有数据副本的
ABPersonRef
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.