Timestamp at which a contact is created

2.4k Views Asked by At

Is there any way to get the timestamp when the contact is created/added . I want to sort contact list time wise in which order they are stored

1

There are 1 best solutions below

4
On

You have creation date property of contacts

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);
}