Julien Pierre
Julien Pierre

Reputation: 467

Monotouch - iPad Simulator issue with UIPopoverController

I'm getting the following 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?

Upvotes: 0

Views: 1031

Answers (2)

vishnu
vishnu

Reputation: 36

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);
} 

Upvotes: 2

miguel.de.icaza
miguel.de.icaza

Reputation: 32694

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.

Upvotes: 2

Related Questions