这是我从设备访问联系方式的代码。当我尝试在另一个类中使用 ABRecordRef 值时,它会在我的程序中崩溃,所以请帮我解决这个问题
在此处输入代码
CFArrayRef people = ABAddressBookCopyArrayOfAllPeople(addressBook);
CFMutableArrayRef peopleMutable = CFArrayCreateMutableCopy(
kCFAllocatorDefault,
CFArrayGetCount(people),
people
);
CFArraySortValues(
peopleMutable,
CFRangeMake(0, CFArrayGetCount(peopleMutable)),
(CFComparatorFunction) ABPersonComparePeopleByName,
(void*) ABPersonGetSortOrdering()
);
arrTemp1=(NSMutableArray *)CFBridgingRelease(peopleMutable);
for (int i=0;i<[arrTemp1 count];i++)
{
allUsers = [[AllUsers alloc]init];
allUsers.person=(__bridge ABRecordRef)(arrTemp1[i]);
}
@interface AllUsers : NSObject
@property (nonatomic,assign) ABRecordRef person;
@end
当我尝试访问另一个类中的人员值时,它会崩溃
AllUsers *currentUser;
ABRecordRef personImageRef = currentUser.person;
NSLog(@"image ref -- %@",currentUser.person);
请帮我解决这个问题...