I want to display the names of each of the CNGroups
in an iPhone's contacts database, and the number of people in each group.
I have the array of CNGroups
, so I can get the name and the identifier properties of each group
I could call
[CNContact predicateForContactsInGroupWithIdentifier: theGroup.identifier] ,
then create a fetch on the CNContactStore
using that predicate and then count the number of elements of the array that is returned and that works.
That seems a long winded and processor intensive way of finding out the number of members, so much so that I'm sure there must be a easier way to achieve this.
Have I missed something or is this the way it has to be done?
Thanks.
That would be how I would do it, if you're finding it to be hitting performance you could always dispatch it onto a background queue since according to the documentation
this framework is optimized for thread-safe, read-only usage