0

I am using ABNewPersonViewController to add or edit address person. Some warnings, however, showed blow are always appreared when I tap button Done. The record data saved to system address book successfully, but I still can't understand the warning.

Jul 21 17:58:41 Jerrys-iPhone YouxinClient[2052] <Notice>: (Warn ) [ABLog]: <ABSource.c ABAddressBookCopyDefaultSource:111> Actual default source doesn't exist
Jul 21 17:58:41 Jerrys-iPhone YouxinClient[2052] <Notice>: (Warn ) [ABLog]: <ABSource.c ABAddressBookCopyDefaultSource:118> Failed to fallback to local source as it is not a valid default source

Code like this:

__block ABAddressBookRef pAddressbook = [PublicFunc createAddressBookInstance];
ABRecordRef person = ABAddressBookGetPersonWithRecordID(pAddressbook, self.oneContact._addressPerson.nAddressId);

ABNewPersonViewController *pPicker = [[ABNewPersonViewController alloc] init];
UINavigationController * nav = [[UINavigationController alloc] initWithRootViewController:pPicker];

pPicker.newPersonViewDelegate = self;
pPicker.displayedPerson = person;

[self presentViewController:nav animated:YES completion:^(void){
FreeMemory_CFRelease(pAddressbook);
}];

[pPicker release]; pPicker = nil;
[nav release]; nav = nil;
jerrylei
  • 340
  • 1
  • 11

1 Answers1

0

I had a similar problem when I used an ABPersonViewController.
I released the addressBook after I assigned the ABPersonRef to ABPersonViewController.displayedPerson, assuming that the ABPersonViewController would retain the addressBook.
The problem was escalated as a Technical Support Incident to Apple, and Apple said that the release of the addressBook was wrong.
Amazingly, as long as the release was there, the static analyzer run successfully, but my app failed. After I deleted the release, the static analyzer warned of a potential memory leak, but the app run successfully.
So my suggestion is

  1. Run Instruments with zombies enables to see if you are overreleasing the address book, and
  2. outcomment the release statement in the completion block and see, if the warnings go away.
Reinhard Männer
  • 14,022
  • 5
  • 54
  • 116