프로젝트 Xcode를 분석하는 동안 사용자 정의 UIBarButtonItem에서 posibe 누출 알림이 제공되었습니다. 누수가 수정되었지만 두 번째로 뷰를로드하는 동안 [super dealloc]은 EXC_BAD_ACCESS 오류를 표시합니다. UIBarButtonItem에서 오토 릴리즈를 제거super dealloc EXC_BAD_ACCESS 오류
는(그래서 경고를 반환) : 화면을 다시로드하는 동안
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:toolbar] autorelease];
더 문제를 제공하지 않습니다.
사용자 정의 UIBarButtonItem 및 할당 해제 코드 : NSZombieEnabled와
- (void)viewDidLoad
{
[super viewDidLoad];
// create a toolbar to have the buttons at the right side of the navigationBar
UIToolbar* toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 150, 44.01)];
toolbar.tintColor = [UIColor clearColor];
[toolbar setTranslucent:YES];
// create the array to hold the buttons, which then gets added to the toolbar
NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:4];
// Create a comments button
propertiesButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemSearch target:self action:@selector(properties)];
[buttons addObject:propertiesButton];
[propertiesButton release];
// Create a comments button
commentaryButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemCompose target:self action:@selector(comments)];
[buttons addObject:commentaryButton];
[commentaryButton release];
// create a versions button
versionsButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:self action:@selector(versions)];
[buttons addObject:versionsButton];
[versionsButton release];
// create a save button
downloadButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemOrganize target:nil action:@selector(download)];
[buttons addObject:downloadButton];
[downloadButton release];
// stick the buttons in the toolbar
[toolbar setItems:buttons animated:NO];
[buttons release];
// and put the toolbar in the nav bar
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:toolbar] autorelease];
[toolbar release];
}
- (void)dealloc
{
[popOverController release];
[propertiesButton release];
[downloadButton release];
[versionsButton release];
[commentaryButton release];
[webView release];
[super dealloc];
}
은 내가
'2011-08-01 10:30:36.571 ProjectName[100:707] *** -[UIBarButtonItem release]: message sent to deallocated instance 0x1fb330'
우리는 문제를 해결하는 방법을 잘하지 않습니다 얻을.
미리 감사드립니다.
매우 감사드립니다! dealloc 메서드에 속성을 추가 할 때 만드는 루틴입니다. 그러나 다른 물체를 통해 물체를 통과 할 때도 물체를 방출합니다. xcode가 문제가 [super dealloc]에 있다고 말하는 것은 아직도 이상합니다. 감사합니다 .1 – Justin
Welcome! Juzzz! – EmptyStack