Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling updateAddressBookWithCompletion doesn't update cards after ABAddressBookRegisterExternalChangeCallback #3

Open
popara opened this issue Jul 15, 2013 · 1 comment

Comments

@popara
Copy link

popara commented Jul 15, 2013

After loading up TTTUnifiedAddressbook and subscribing to notification center listening for TT_UNIFIED_ADDRESS_BOOK_REQUEST_UPDATE_NOTIFICATION, I get the notification that address book is updated, I call the - updateAddressBookWithCompletion:

But, cards that are returned in .allCards are old cards without updated data for the contact. I care about the emails array.

I have looked at the source code but I am not sure, how do to update managed object per record id with new data.

@popara
Copy link
Author

popara commented Jul 15, 2013

One important detail on the issue:

while executing unifyAddressBook:(AddressBookRef)addressBook I see updated data by querying into data with this piece of code:

 ABAddressBookRef addressBook = [[self class] newAddressBookInline];
 CFArrayRef people = ABAddressBookCopyArrayOfAllPeople(addressBook);

 for (CFIndex i = 0; i < CFArrayGetCount(people); i++) {
     ABRecordRef person = CFArrayGetValueAtIndex(people, i);
     ABMultiValueRef emails = ABRecordCopyValue(person, kABPersonEmailProperty);
     NSMutableArray *nsemails = [NSMutableArray array];

     for (CFIndex j=0; j < ABMultiValueGetCount(emails); j++) {
         NSString* email = (__bridge NSString*)ABMultiValueCopyValueAtIndex(emails, j);
         [nsemails addObject:email];
     }
     NSLog(@"Contact Emails: %@", nsemails);
}


but same code gives me staled data when called in

  • (NSArray *) allCards;

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant