Reputation: 4833
Has anyone had issues with this code...
ABRecordRef person = ABAddressBookGetPersonWithRecordID (addressBook,recordID);
I have had major issues with this so far. I have previously posted this question Intermittent error accessing core data model / contacts database
However, I have now tracked it down to this method returning a NULL value despite there being legitimate addressBook and recordID values.
Any idea of why this might be happening?
Many thanks
Upvotes: 2
Views: 1492
Reputation: 4833
Posting answer in case it helps others...
It turns out the issue was memory related. I have created an addressBook with: ABAddressBookCreate(). This was happening inside a loop so was being created over and over again. The solution was to move the creation outside of the loop and balance with CFRelease(addressBook); command.
Hope this helps others!!
Upvotes: 1
Reputation: 102
I have successfully done a addressbook with add,edit and delete the record from the contact list.there is no such type of error comes. put this in .h file...
ABRecordID
recordID;
put following code in the
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
{
recordID = ABRecordGetRecordID(person);
NSLog(@"Record id is %d",recordID);
}
if You getting the reoord id in that then i think there would be no such problem occours. Lets try ...
Upvotes: 0