当我尝试呈现一个UIPopoverController时崩溃/ SIGABRT

嗨,我在我的智慧结束,我在这里做错了。 我正在使用ios5,没有崩溃,如果我不打电话presentPopoverFromBarButtonItem。 有没有人经历类似的事情? 我检查了苹果开发者论坛,谷歌,堆栈溢出,找不到任何东西。

在gdb上运行bt也没有显示任何提示。

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]; 

我假设你正在使用ARC,因为我有这个相同的问题。 你必须坚持你创build的popup框,否则它的保留计数将会减less,当你到达方法范围的末尾时它将被释放。

所以创build一个属性并合成它,直到你不再需要它,并从屏幕上移除它,它被删除后设置为零。