崩溃/ SIGABRT时,我试图提出一个UIPopoverController [英] Crash/SIGABRT when I try to present a UIPopoverController

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

问题描述

我在我的智慧结束,我在这里做错了。我使用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.

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

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