wie kann ich ein ABRecordRef zu einem NSMutableArray in iPhone?

Ich möchte ein array erstellen, die der ABRecordRef(s) zum speichern der Kontakte, die über eine gültige Geburtstags-Feld.

   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];
       }
   }

Der compiler zeigt diese Warnung:
warning: passing argument 1 of 'addObject:' discards qualifiers from pointer target type
Ich suchte im web und festgestellt, ich habe zu werfen ABRecordRef zu einem ABRecord* zum speichern in einem NSMutableArray.

[bContacts addObject:(ABRecord*) ref];

Aber es scheint ABRecord ist nicht Teil der iOS-frameworks. Nun, wie ich speichern ABRecordRef zu NSMutableArray?

InformationsquelleAutor Hadu | 2011-05-20
Schreibe einen Kommentar