我碰到了,當我popToRootViewController
,這是我設置它的方式。關閉popover,然後popToRootViewController,EXC_BAD_ACCESS
我:
@property (nonatomic, retain) UIPopoverController *popover;
中的dealloc:
[popover release];
當按鈕被按下
if (self.popover == nil) {
DetailViewController *detailView = [[[DetailViewController alloc] init] autorelease];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(GoToTest:) name:TestDetailPressed object:detailView];
self.popover = [[[UIPopoverController alloc] initWithContentViewController:detailView] autorelease];
self.popover.delegate = self;
[self.popover presentPopoverFromRect:frame inView:self.scrollView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
我DetailViewController
本質上只是一個UITableView
。當選擇一排,我發佈一個通知回到這個當前類GoToTest:
- (void)GoToTest:(NSNotification *)notification {
if ([self.popover isPopoverVisible]) {
[self.popover dismisspopoverAnimated:YES];
[self handleDismissedPopover:self.popover];
}
[self.navigationController popToRootViewControllerAnimated:NO];
}
- (void)handleDismissedPopover:(UIPopoverController *)popoverController {
self.popover = nil;
self.popover.delegate = nil;
[[NSNotificationCenter defaultCenter] removeObserver:self name:TestDetailPressed object:nil];
}
- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController {
[self handleDismissedPopover:popoverController;
}
當我在儀器運行它,我得到的殭屍消息
-[UIPopoverController _popoverDismissAnimationCompleted]
和UIViewController
有此時的refCt爲-1。
我會想象popover.delegate = nil; popover後=零;是毫無意義的。 – jbat100
@ jbat100它是,很好的捕獲。更新回答) – chown
@chown malloc:使用標準記錄器記錄malloc堆棧到磁盤是什麼意思? –