I'm devleloping an ABAddressBook based application. I want to use predicates to evaluate or compare the objects in abaddressbook. But it seems like ABAddreesBook is a Core Fundation framework and does not support KVC. Does this mean that I can't use predicates in my application?
Or is there any other way to do things like predicates?
The short answer is: you can't.
The long answer is: you can, but it'd be a lot of work. I'd probably do something like this:
NSExpressions
of the predicate to aggregate all the -keyPath
strings and store them in an array. These will be the properties of the ABRecord
objects that you'll be querying.ABRecord
objects and create a dictionary to represent each one. This dictionary would have the recordID as well as the ABRecordCopyValue()
value of each of the "keypaths" you want, keyed to the property name.ABRecord
objects and returned.This sounds like an interesting problem. I'll think about this a bit more and perhaps come back and edit my answer.