iphone addressbook - getting null item in ABAddressBookGetPersonWithRecordID

别说谁变了你拦得住时间么 提交于 2019-11-30 13:43:00

NSNumber is an object, not an integer.

To insert an NSNumber object into a format string (such as for NSLog), you should use %@ (not %d).

NSNumber *recordId = [NSNumber numberWithInteger:ABRecordGetRecordID(person)];
NSLog(@"record id is %@",recordId);

Similarly, if you have the recordID in an NSNumber object, you can get the integer value using integerValue:

ABRecordRef person = ABAddressBookGetPersonWithRecordID(ab,recordId.integerValue);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!