NSInvalidArgumentException [英] NSInvalidArgumentException
问题描述
我从这个例程中添加了:(id)发件人后,我得到一个崩溃,所以我可以确定哪个按钮调用它。当设置为纯旧的toggleView3它工作完美。
I'm getting a crash from this routine after adding the :(id)sender so I could determine which button called it. When set up as plain old toggleView3 it works perfectly. The crash occurs when detailView is toggled back to docView.
'NSInvalidArgumentException',原因:'*** - [RootViewController toggleView3]:无法识别的选择器发送到实例0x524a00'
2009-04-07 12:29:44.421 eTarot [11405:20b]堆栈:
-(IBAction)toggleView3:(id)sender{
if (detailViewController == nil) {
[self loadDetailViewController];
}
UIView *docView = docViewController.view;
UIView *detailView = detailViewController.view;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:([docView superview] ? UIViewAnimationTransitionFlipFromRight : UIViewAnimationTransitionFlipFromLeft) forView:self.view cache:YES];
if ([docView superview] != nil) {
[detailViewController viewWillAppear:YES];
[docViewController viewWillDisappear:YES];
[docView removeFromSuperview];
[self.view addSubview:detailView];
[self.view insertSubview:detailNavigationBar aboveSubview:detailView];
[docViewController viewDidDisappear:YES];
[detailViewController viewDidAppear:YES];
} else {
[docViewController viewWillAppear:YES];
[detailViewController viewWillDisappear:YES];
[detailView removeFromSuperview];
[detailNavigationBar removeFromSuperview];
[self.view addSubview:docView];
[detailViewController viewDidDisappear:YES];
[docViewController viewDidAppear:YES];
}
[UIView commitAnimations];
}
推荐答案
当选择器的正确名称为 toggleView3:
时,即使用冒号和参数时,消息 toggleView3
它们可能看起来与你相似,但它们与Objective-C完全不同。
You're sending a view the message toggleView3
when the correct name of the selector is toggleView3:
— that is, with a colon and argument. They may look similar to you, but they're totally different methods to Objective-C.
这篇关于NSInvalidArgumentException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!