I'm getting the fol开发者_StackOverflow社区lowing error, only on the simulator and not on the iPad itself!
Monotouch.Foundation.MonoTouchException has been thrown
"Objective-C exception thrown. Name: NSGenericException
Reason: - [UIPopoverController dealloc] reached while popover is still visible."
Has anyone got an idea how to solve this?
This causes the problem...
private void GetPopsUps()
{
UIPopoverController uipoc = new UIPopoverController(new PopController());
uipoc.PopoverContentSize = new SizeF(200f, 300f);
uipoc.PresentFromRect (new RectangleF(0,0, 200, 300), this.View,
UIPopoverArrowDirection.Up, true);
}
This solves it (for me)..
UIPopoverController uipoc;
private void GetPopsUps()
{
uipoc = new UIPopoverController(new PopController());
uipoc.PopoverContentSize = new SizeF(200f, 300f);
uipoc.PresentFromRect (new RectangleF(0,0, 200, 300), this.View,
UIPopoverArrowDirection.Up, true);
}
My guess is that you let the garbage collector remove the reference.
I would love to see how this is happening, so I could add a special case in the future, but for now, try keeping a reference to the UIPopover and UIPopoverController.
精彩评论