尝试显示ViewController后出现奇怪错误

时间:2012-03-01 20:56:22

标签: ios ios5 uitabbarcontroller

我有一个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,但没有故事板。

谢谢!

1 个答案:

答案 0 :(得分:1)

你试图访问你最喜欢的viewcontroller上的属性单例。也许你的nib文件中有一个旧的链接?