I am trying to access address book emails of iPad.
The part of code is :
ABAddressBookRef addressBookRef = ABAddressBookCreateWithOptions(NULL, NULL);
ABRecordRef recordRef = ABAddressBookCopyDefaultSource(addressBookRef);
CFArrayRef arrayRef = ABAddressBookCopyArrayOfAllPeopleInSourceWithSortOrdering(addressBookRef, recordRef, kABPersonSortByFirstName);
for(int i = 0;i<ABAddressBookGetPersonCount(addressBookRef);i++)
{
ABRecordRef ref = CFArrayGetValueAtIndex(arrayRef, i);
ABMultiValueRef emails = ABRecordCopyValue(ref, kABPersonEmailProperty);
.
.
.
.
The crash is reproducible only on client iPad-Mini. we tried to reproduce crash but its not happening.
After analyzing the debug build we got to know that crash is happening in Line "ABMultiValueRef emails = ABRecordCopyValue(ref, kABPersonEmailProperty);". The crash is not happening every time. It happening once in 2-3 attempt to access addressBook emails. only for client.
My doubt is "ABRecordRef ref = CFArrayGetValueAtIndex(arrayRef, i);" may be nil or empty. But in what case this may be nil or empty?
can any one help me to know what may be the reason for crash.