KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to create an array of ABRecordRef(s) to store contacts which have a valid birthday field. NSMutableArray* bContacts = [[NSMutableArray alloc] init]; ABAddressBookRef addressBook = ABAddressBookCreate(); CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook); CFIndex nPeople = ABAddressBookGetPersonCount(addressBook); for( int i = 0 ; i < nPeople ; i++ ) { ABRecordRef ref = CFArrayGetValueAtIndex(allPeople, i ); NSDate* birthdayDate = (NSDate*) ABRecordCopyValue(ref, kABPersonBirthdayProperty); if (birthdayDate != nil){ [bContacts addObject:ref]; } } The compiler shows this warning: warning: passing argument 1 of 'addObject:' discards qualifiers from pointer target type I searched the web and found I have to cast ABRecordRef to a ABRecord* to be able to store in a NSMutableArray. [bContacts addObject:(ABRecord*) ref]; But it seems ABRecord is not part of iOS frameworks. Now how I store ABRecordRef to NSMutableArray?
Tags (comma-separated)
Save Edits
Cancel