Reputation: 651
I have been working on app for months without any popover issues. All of a sudden today popovers have gone to hell.
I have tried this a few different ways and no matter when I dismiss the popover by pressing a button in the popover OR tapping outside of the popover the app crashes.
Using Instruments, I can see there is a zombie reference that only happens after the popover has been dismissed:
*** -[UITransitionView willRemoveSubview:]: message sent to deallocated instance 0x7f9985bcd980
So I have logged that stack and there isn't much help as the whole stack has to do with UIKit and built in animations, etc.
Using standard UIPopovers
self.popover = [[UIPopoverController alloc] initWithContentViewController:self.navVC];
self.popover.backgroundColor = [UIColor accentColor];
self.popover.delegate =self;
[self.seatingChartPopover presentPopoverFromRect:CGRectMake(x,y, 1, 1)
inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
Or use the new UIPopoverPresentationController method in ios8
self.navVC.modalPresentationStyle = UIModalPresentationPopover;
UIPopoverPresentationController* popover = self.navVC.popoverPresentationController;
self.navVC.preferredContentSize = [self.childVC preferredContentSize];
popover.sourceView = self.view;
popover.sourceRect = CGRectMake(x,y, 1, 1);
popover.permittedArrowDirections = UIPopoverArrowDirectionAny;
[self presentViewController:self.seatingChartNavController animated:YES completion:nil];
I have made sure that all of the view controllers involved have a strong reference.
As I mentioned, I have not changed the the code that presents this popover in months and it's been working fine until today. I have spent hours debugging this to no avail.
Also, If I just present self.navVC as a normal modal view, the view displays fine and dismisses fine. It's only when it's set as a popover that it fails
Thanks in advance for any help.
Upvotes: 0
Views: 444
Reputation: 651
I'm ashamed to admit that I accidentally put a dealloc method in one of my UIView Categories.
I am surprised this didn't bring up any sort of compiler warning, but after removing that there hasn't been any more bizarre crashing.
Upvotes: 1