当我尝试呈现 UIPopoverController 时崩溃/SIGABRT [英] Crash/SIGABRT when I try to present a UIPopoverController

查看:20
本文介绍了当我尝试呈现 UIPopoverController 时崩溃/SIGABRT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对我在这里做错的事情束手无策.我正在使用 ios5,如果我不调用 presentPopoverFromBarButtonItem,没有任何崩溃.有没有人经历过类似的事情?我查了苹果开发者论坛,谷歌,堆栈溢出,什么都找不到.

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.

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

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

推荐答案

我假设您正在使用 ARC,因为我遇到了同样的问题.你必须坚持你创建的弹出窗口,否则它的保留计数会减少,当你到达方法范围的末尾时它会被释放.

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.

因此,创建一个属性并合成它,直到您不再需要它并将其从屏幕中删除,删除后将其设置为 nil.

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.

这篇关于当我尝试呈现 UIPopoverController 时崩溃/SIGABRT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆