【发布时间】:2011-03-27 09:43:56
【问题描述】:
我在 iPhone 设备上执行以下代码时遇到了一些奇怪的内存泄漏:
@implementation TestViewController
@synthesize myButton;
- (IBAction)buttonPressed {
ABPeoplePickerNavigationController* selectContactViewController = nil;
selectContactViewController = [[ABPeoplePickerNavigationController alloc] init];
selectContactViewController.peoplePickerDelegate = self;
[self presentModalViewController:selectContactViewController animated:YES];
[selectContactViewController release];
}
简单的释放选择器如下:
- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker {
[self dismissModalViewControllerAnimated:YES];
}
仪器标记“selectContactViewController = [[ABPeoplePickerNavigationController alloc] init];”作为泄漏。知道为什么吗?
【问题讨论】:
标签: iphone memory-management memory-leaks