访问用户通讯录时出现问题。我的代码是
ABMultiValueRef email = ABRecordCopyValue(aSource, kABPersonEmailProperty);
NSString* email_lbl;
for(CFIndex i = 0; i < ABMultiValueGetCount(email); i++) {
email_lbl = (NSString*)ABMultiValueCopyLabelAtIndex(email, i);
if([email_lbl isEqualToString:(NSString *)kABHomeLabel])
{
home_email = [(NSString*)ABMultiValueCopyValueAtIndex(email, i)retain];
}
if([email_lbl isEqualToString:(NSString *)kABWorkLabel])
{
work_email = [(NSString*)ABMultiValueCopyValueAtIndex(email, i)retain];
}
if([email_lbl isEqualToString:(NSString *)kABOtherLabel])
{
basic_email = [(NSString*)ABMultiValueCopyValueAtIndex(email, i)retain];
}
}
登录 home_email、work_email、basic_email 时收到 Exc_bad_access 信号。