我正在尝试计算整个通讯簿中生日条目的总数。
问题线
/* This line crashes only when using kABPersonBirthdayProperty */
ABMultiValueRef lBirthdays = ABRecordCopyValue(lRef, kABPersonBirthdayProperty);
/* Note that when this line is changed to another `ABPropertyID`, it works fine.
Only seems to crash on NSCFDates.
*/
有更多代码可以遍历整个通讯簿中的所有联系人,但与此问题无关。
int totalBirthdayEntries = 0;
CFIndex lContactBirthdayCount = ABMultiValueGetCount( lBirthdays );
for (int births = 0; births < lContactBirthdayCount; births++)
{
totalBirthdayEntries++;
}
NSLog(@"Total Birthdays in Address Book: %i",totalBirthdayEntries);