views:

592

answers:

1

I've created an address book copy with

ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef people = ABAddressBookCopyArrayOfAllPeople(addressBook);
CFMutableArrayRef peopleMutable = CFArrayCreateMutableCopy(
                 kCFAllocatorDefault,
                 CFArrayGetCount(people),
                 people
                 );

now i would have just people with an address set in.

I've tried filtering with NSPredicate, but I don't know how to use the predicateWithFormat correctly with address book constants. This doesn't work:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(%@ like %@)", kABPersonFirstNameProperty, aVariable];

Can someone suggest me something? Thanks

+3  A: 

Take a look at http://github.com/erica/ABContactHelper -- if it doesn't have code that does what you want already, it should be a useful guide for writing it yourself.

Josh Bleecher Snyder