简体   繁体   English

iOS alloc popover控制器导致崩溃

[英]iOS alloc popover controller causes crash

Hi I'm trying to make a popover happen on the click of a button, something I've done successfully before, but for some reason I can't make it happen. 嗨,我试图通过单击按钮使弹出窗口发生,这是我之前成功完成的事情,但是由于某种原因,我无法实现它。 I'm using iOS 5 now. 我现在正在使用iOS 5。

So far I have 到目前为止,我有

-(void)changetablebuttonPressed:(id)sender{
UIButton *button = (UIButton*)sender;

changetableView = [[ChangeTableViewController alloc] initWithNibName:@"ChangeTableViewController" bundle:nil];
changetablePopover = [[UIPopoverController alloc] initWithContentViewController:changetableView];
[changetablePopover presentPopoverFromRect:button.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:TRUE];     
}

The code causes a SIGABRT error after trying to initWithContentViewController or even a straightforward init . 该代码在尝试使用initWithContentViewController甚至是直接的init之后会导致SIGABRT错误。 I've checked that changetableView is not null and so I'm stumped! 我检查过changetableView不为null,所以很changetableView

The only custom code in the ChangeTableViewController is in viewDidLoad and is self.contentSizeForViewInPopover = CGSizeMake(320, 144); ChangeTableViewController唯一的自定义代码在viewDidLoad并且是self.contentSizeForViewInPopover = CGSizeMake(320, 144);

Any guesses would be appreciated. 任何猜测将不胜感激。

EDIT : The exception isn't being printed to the console (I don't think), here is the entire output, with Zombies enabled: 编辑 :异常未打印到控制台(我不认为),这是启用了Zombies的整个输出:

GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Mon Aug 15 16:03:10 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".sharedlibrary apply-load-rules all
Attaching to process 7596.
Catchpoint 2 (throw)Pending breakpoint 1 - "objc_exception_throw" resolved

Catchpoint 2 (exception thrown).(gdb) bt
#0  0x03dc9a4f in __cxa_throw ()
#1  0x01745e15 in objc_exception_throw ()
#2  0x0155ca78 in +[NSException raise:format:arguments:] ()
#3  0x0155c9e9 in +[NSException raise:format:] ()
#4  0x001c7f0d in -[UIViewController _loadViewFromNibNamed:bundle:] ()
#5  0x001c83a9 in -[UIViewController loadView] ()
#6  0x001c85cb in -[UIViewController view] ()
#7  0x00596559 in -[UIPopoverController _transitionFromViewController:toViewController:animated:] ()
#8  0x00593b13 in -[UIPopoverController initWithContentViewController:] ()
#9  0x0000b7f7 in -[DetailViewController changetablebuttonPressed:] (self=0x6a510e0, _cmd=0x18af6, sender=0x6a696f0) at .../DetailViewController.m:385
#10 0x015b5ec9 in -[NSObject performSelector:withObject:withObject:] ()
#11 0x001055c2 in -[UIApplication sendAction:to:from:forEvent:] ()
#12 0x0010555a in -[UIApplication sendAction:toTarget:fromSender:forEvent:] ()
#13 0x001aab76 in -[UIControl sendAction:to:forEvent:] ()
#14 0x001ab03f in -[UIControl(Internal) _sendActionsForEvents:withEvent:] ()
#15 0x001aa2fe in -[UIControl touchesEnded:withEvent:] ()
#16 0x003c3a2a in _UIGestureRecognizerUpdate ()
#17 0x015889ce in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
#18 0x0151f670 in __CFRunLoopDoObservers ()
#19 0x014eb4f6 in __CFRunLoopRun ()
#20 0x014eadb4 in CFRunLoopRunSpecific ()
#21 0x014eaccb in CFRunLoopRunInMode ()
#22 0x0149d879 in GSEventRunModal ()
#23 0x0149d93e in GSEventRun ()
#24 0x00102a9b in UIApplicationMain ()
#25 0x00002b42 in main (argc=1, argv=0xbfffed78) at .../main.m:16
#26 0x00002ab5 in start ()
Current language:  auto; currently objective-c
(gdb) 

Check your nib for a rogue IBOutlet. 检查笔尖是否有恶意的IBOutlet。 It sometimes happens when you defined a view (in Interface Builder) as one class, then later change it to another class, but don't clean up the old connections. 当您(在Interface Builder中)将视图定义为一个类,然后将其更改为另一个类,但是不清理旧的连接时,有时会发生这种情况。 (I had originally stated it was simply from deleting the outlet in your .h, but realized that was the wrong scenario, and recalled the correct one). (我最初曾说过,这只是删除.h中的出口,但意识到这是错误的情况,并召回了正确的情况)。

You are looking for an outlet with the yellow triangle to the right, like: 您正在寻找右边带有黄色三角形的插座,例如:

在此处输入图片说明

It is happening during the loading of the view, which is when the nib loader is trying to pair up objects with their outlets. 这是在视图加载期间发生的,这是当笔尖加载器试图将对象与其出口配对时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM