1
votes

I have a UIPopoverController presented from a UIBarButtonItem. I have another UIBarButtonItem that is a home button that when pressed,

[self.navigationController popToRootViewControllerAnimated:YES];

The problem is, my popover is still visible and then I get a SIGABRT when I popToRootViewController since in my dealloc method, I release memory on the popover. The popover stays visible as well. The error is

Terminating app due to uncaught exception 'NSGenericException', reason: '-[UIPopoverController dealloc] reached while popover is still visible.'

What I don't understand is, I thought the default action was for a popover to be dismissed when you click somewhere else on the screen. How do I handle this use case? Thanks.

1

1 Answers

0
votes

I think the problem is that the popover animates away when you dismiss it, and this animation is probably still in progress when you release your reference to the popover. Try dismissing the popover immediately before releasing your reference to it with dismissPopoverAnimated:NO.