【问题标题】:Monotouch - iPad Simulator issue with UIPopoverControllerMonotouch - UIPopoverController 的 iPad 模拟器问题
【发布时间】:2011-09-26 21:52:47
【问题描述】:

我收到以下错误,仅在模拟器上而不是在 iPad 本身上!

Monotouch.Foundation.MonoTouchException has been thrown 
"Objective-C exception thrown. Name: NSGenericException 
Reason: - [UIPopoverController dealloc] reached while popover is still visible."

有人知道如何解决这个问题吗?

【问题讨论】:

  • 作为 Miguel 的回答,您必须为 UIPopoverController 创建一个实例变量。

标签: ipad xamarin.ios ios-simulator uipopovercontroller


【解决方案1】:

这会导致问题...

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

这解决了它(对我来说)..

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

【讨论】:

    【解决方案2】:

    我的猜测是你让垃圾收集器删除了引用。

    我很想看看这是怎么发生的,所以我可以在将来添加一个特殊情况,但现在,请尝试保留对 UIPopover 和 UIPopoverController 的引用。

    【讨论】:

    • 模拟器运行 GC 比在实际设备上更积极。这是为了帮助在内存容量比您可能在模拟器上或在模拟器中测试的设备低得多的真实设备上捕获 GC 问题(因为它将使用您的机器提供的功率)。
    • 我在设备中也遇到了这个问题
    猜你喜欢
    • 2012-05-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-30
    • 2011-09-28
    • 1970-01-01
    相关资源
    最近更新 更多