这是保存更改后重新加载我的地址簿的功能,该行
self.addressbook=ABAddressbookCreateWithOptions()
和
self.contactAdd=ABAddressBookCopyArrayOfAllPeople(self.addressBook)
显示为潜在的内存泄漏点。
contactAdd 是 CFAr r
ayRef 类型,地址簿是ABAddressBookRef
-(void)reloadAddressBook
{
// if(self.addressBook)
// CFRelease(self.addressBook);
self.addressBook = ABAddressBookCreateWithOptions(NULL,NULL);
if(ABAddressBookHasUnsavedChanges(self.addressBook))
{
ABAddressBookSave(self.addressBook,NULL);
}
// if(self.contactAdd)
// CFRelease(self.contactAdd);
self.contactAdd=ABAddressBookCopyArrayOfAllPeople(self.addressBook);
}