0

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

Anurag Kabra
  • 444
  • 1
  • 5
  • 18

1 Answers1

0

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);
}
Mert
  • 6,025
  • 3
  • 21
  • 33
  • but what will happen to old number already stores in addressbook – Anurag Kabra Mar 20 '13 at 15:34
  • What do you mean? which old number? who stores the old number? – Mert Mar 20 '13 at 15:40
  • I want the timestamp of all numbers which were stored in my iphone So that I can sort the numbers according to time at which I saved them. – Anurag Kabra Mar 21 '13 at 07:50
  • You have only creation date and last modification date of contacts and not numbers. I do not think iOS saves dates for every number. It means you can sort the contacts but not the numbers. – Mert Mar 21 '13 at 10:17