0

I am accessing a contact from the address book. I don't want to import a Facebook contact while copying the rest of the contacts. So how can I identify if the contact was imported from Facebook? For copying the array of people, I'm using this simple method:

ABRecordRef source = ABAddressBookCopyDefaultSource(ref);
NSArray *allContacts  = (__bridge NSArray *)(ABAddressBookCopyArrayOfAllPeopleInSource(ref, source));

for (int i = 0; i < [allContacts count]; i++) {

Person *person = [[Person alloc] init];

ABRecordRef contactPerson = (__bridge ABRecordRef)allContacts[i];

NSString *firstName = (__bridge_transfer NSString *)ABRecordCopyValue(contactPerson, kABPersonFirstNameProperty);

NSString *lastName = (__bridge_transfer NSString *)ABRecordCopyValue(contactPerson, kABPersonLastNameProperty);

int ID=ABRecordGetRecordID(contactPerson);

        CFTypeRef num=ABRecordCopyValue(contactPerson, kABPersonPhoneProperty);

        NSString  *phoneNumber = (__bridge NSString *) ABMultiValueCopyValueAtIndex(num, 0);


       if(phoneNumber.length>0)
        {
         [List addObject:person];
        }

so which property of record can able to detect Facebook contact ?

Anoop
  • 409
  • 3
  • 13
  • yep ! checking some properties in loop then adding in array – Anoop Aug 21 '14 at 13:34
  • Then post that code so we can see where the error is, on stackoverflow people will better able to help you if you post you full attempts and not just request code, which frowned up and might get you downvoted. – rckoenes Aug 21 '14 at 13:39
  • @rckoenes , i'm edit some line of code above so let me know will it be ok for me ? – Anoop Aug 21 '14 at 13:44
  • You should post your code where you try and detect if the user is synced form facebook. Which to my knowledge is not possible since the source of the sync is not start in the person, you could just check if the user has a facebook ID in its records. – rckoenes Aug 21 '14 at 13:47

0 Answers0