我有一個ViewController,它被加載到一個tabbar。嘗試顯示ViewController後奇怪的錯誤
目前在整個事情被顯示,程序接收SIGABRT
,並給我留下了這個錯誤:
2012-03-01 21:53:21.118 GameControl[78897:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<FavoriteViewController 0x68c8620> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key singleton.
任何人的想法是什麼,可能意味着什麼?
繼承人的代碼,我安裝我的看法:
RootViewController *rootController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
FavoriteViewController *favoriteController = [[FavoriteViewController alloc] initWithNibName:@"FavoriteViewController" bundle:nil];
rootController.xmlData = self.xmlData;
favoriteController.xmlData = self.xmlData;
navigationController = [[UINavigationController alloc] initWithRootViewController:rootController];
tabBarController = [[UITabBarController alloc] init];
navigationController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Root" image:nil tag:0];
favoriteController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Favorites" image:nil tag:0];
tabBarController.viewControllers = [NSArray arrayWithObjects:navigationController, favoriteController, nil];
if ([[self.window subviews] count] != 0) {
[[[self.window subviews] objectAtIndex:0] removeFromSuperview];
}
[self.window addSubview:tabBarController.view];
和好,我使用的IOS5,與ARC但沒有故事板。
謝謝!
它看起來像你沒有將favourController添加到標籤欄控制器或其他任何地方。那是故意的嗎? – Jim 2012-03-01 21:08:28
那麼,我出於測試的原因改變了這個... 要編輯。 – 2012-03-01 21:11:33