Reputation: 115
this is my code to access contact details from device. when i try to use the ABRecordRef value in another class it turn to crash in my program so please help me to solve this
enter code here
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
when i try to access the person value in another class then it turn to crash
AllUsers *currentUser;
ABRecordRef personImageRef = currentUser.person;
NSLog(@"image ref -- %@",currentUser.person);
please help me to solve this issue...
Upvotes: 0
Views: 300
Reputation: 5060
Please check that you property made is assign
make it strong
and try and please let me know.
@property (nonatomic,readonly) ABRecordRef person;
Upvotes: 1