Hi I am at my wits end with what I am doing wrong here. I am using ios5 and nothing crashes if I do not call presentPopoverFromBarButtonItem. Has anyone experienced anything similar? I checked the apple developer forums, google, stack overflow and couldn't find anything.
Running bt on gdb didn't reveal any hints either.
UIViewController *viewTwo;
viewTwo = [[ViewTwo alloc] initWithNibName:@"ViewTwo" bundle:nil];
UIPopoverController *popover;
popover = [[UIPopoverController alloc] initWithContentViewController:viewTwo];
[popover presentPopoverFromRect:[theButton bounds]
inView:theButton
permittedArrowDirections:UIPopoverArrowDirectionLeft
animated:NO];
I am assuming you are using ARC as I had this same issue. You have to hold on to the popup you have created otherwise its retain count will be decreased and it will be released when you get to the end of the methods scope.
So create a property and synthesise it until you no longer need it and remove it from screen, the set it to nil after it has been removed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With