0

Hello everyone I have a remote database of users which contains emails. Now i have my app which has to list all contacts emails from the address book and check if the user is already registered on the database. I am thinking to send all email and check against database and response back the data and display it in a uitableview. But is that the right approach ? I am thinking of bandwidth and loading time if we have to check suppose for 2000 or 3000 emails addresses?

veereev
  • 2,650
  • 4
  • 27
  • 40

1 Answers1

0

Use ABPeoplePickerNavigationControllerDelegate to retrive Email from contact list using kABPersonEmailProperty.

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker
      shouldContinueAfterSelectingPerson:(ABRecordRef)person {

    CFStringRef emailName = nil;
    ABMultiValueRef emails = ABRecordCopyValue(person, kABPersonEmailProperty);
    emailName = ABMultiValueCopyValueAtIndex(emails, 0);

    /*
        Here make code for DB
        1) Make email Field of DB unique.
        2) select query like:
            select * from tblContact where email = emailName;

           get count of Record set.
        3) if record set count == 0 then 
               insert emailName in tblContact using insert Query.
           else
               Do nothing
    */
    if(emailName)
         CFRelease(emailName);
    if(emails)
         CFRelease(emails);

    return NO;
}
Tarang
  • 96
  • 1
  • 6