下面是一个示例代码,我正在尝试将iphone的联系人导入到我的应用程序中。内存管理问题
-(IBAction)import_Clicked:(id)sender{
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init]; //leaking here
picker.peoplePickerDelegate = self;
// Display only a person's phone, email, and birthdate
NSArray *displayedItems = [NSArray arrayWithObjects:[NSNumber numberWithInt:kABPersonPhoneProperty],
[NSNumber numberWithInt:kABPersonEmailProperty],
[NSNumber numberWithInt:kABPersonBirthdayProperty], nil];
picker.displayedProperties = displayedItems;
[self presentModalViewController:picker animated:YES];
[picker release];}
我在仪器上运行它,它显示我100%泄漏在我分配abpeoplepickernavigationcontroller行。我在persentmodalviewcontroller后发现它。我还能在哪里出错。 任何帮助,请.....
这是直接从Apple的[QuickContacts](http://developer.apple.com/library/ios/#samplecode/QuickContacts/Introduction/Intro.html#//apple_ref/doc/uid/DTS40009475-Intro- DontLinkElementID_2)项目,不是吗? – 2011-04-03 09:35:27
是的,它是QuickContactsViewController.m> http://developer.apple.com/library/ios/#samplecode/QuickContacts/Listings/Classes_QuickContactsViewController_m.html#//apple_ref/doc/uid/DTS40009475-Classes_QuickContactsViewController_m-DontLinkElementID_6 – 2011-04-03 09:37:55