创建联系人的时间戳

时间:2013-03-20 15:15:16

标签: ios objective-c abaddressbook abaddressbooksource

有没有办法在创建/添加联系人时获取时间戳。我想按时间顺序对联系人列表进行排序

1 个答案:

答案 0 :(得分:0)

您有联系人的创建日期属性

NSArray *allPeople = ((__bridge_transfer NSArray *)ABAddressBookCopyArrayOfAllPeople(addresbook));

for (int i = 0; i < allPeople.count; i++) {
    ABRecordRef *person = (ABAddressBookRef *)[allPeople objectAtIndex:i];

    NSDate *creationDate = ((__bridge_transfer NSDate*)ABRecordCopyValue(person, kABPersonCreationDateProperty));
    NSLog(@"Creation date: %@ of entry: %@", creationDate, person);
}