我正在与多个UIViewController
s一起工作。我只是添加了一个新的,当我点击新的按钮时,应用程序崩溃,出现以下错误。在第一掷添加视图控制器
2011-10-11 22:51:57.227 BG-Prep[9156:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ResourcesViewController 0x4b28540> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key delegate.'
*调用堆栈:
的代码是相同的(除了文件名)到正常工作的其他两页。这是什么告诉我?
- (IBAction)resourceButtonTapped:(id)sender;
{
NSLog(@"Tapped the resource button");
ResourcesViewController *resourcesViewController = [[[ResourcesViewController alloc]
initWithNibName:@"ResourcesViewController" bundle:[NSBundle mainBundle]] autorelease];
NSLog(@"receiver's type: %@", NSStringFromClass([resourcesViewController class]));
resourcesViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:resourcesViewController animated:YES];
}
如果我取消了两行,我得到如下:
2011-10-12 14:38:51.533 BG-Prep[10070:207] Tapped the resource button
2011-10-12 14:38:51.535 BG-Prep[10070:207] receiver's type: ResourcesViewController
最后一行[self presentModalViewController:resourcesViewController animated:YES];
是导致应用程序崩溃,但为什么呢?
ResourcesViewController是UIViewController的子类吗? – titaniumdecoy
是的,它是一个子类...我在上面的描述中添加了更多信息。 – padapa