下面是一個示例代碼,我正在嘗試將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