我正在與多個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