我在使用IOS6的TOSplitViewController(http://blog.trustedones.com/development/ipad-uisplitviewcontroller-replacement-for-sethidesmasterviewinportrait)时遇到问题,因为我的应用程序在加载屏幕后立即崩溃,错误是这样的:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason:
'[setValue:forUndefinedKey:]:此类与密钥navRoot不符合密钥值编码。'`
First throw call stack:
(0x1964012 0x1294e7e 0x19ecfb1 0x28a711 0x20bec8 0x20b9b7 0x236428 0x7d70cc 0x12a8663 0x195f45a 0x7d5bcf 0x69ae37 0x69b418 0x7e934e 0x69b648 0x69b882 0x69bb2a 0x6b2ef5 0x6b2fdb 0x6b3286 0x6b3381 0x6b3eab 0x6b3fc9 0x6b4055 0x7b93ab 0x60a92d 0x12a86b0 0x2dfbfc0 0x2df033c 0x2dfbeaf 0x6a98cd 0x5f21a6 0x5f0cbf 0x5f0bd9 0x5efe34 0x5efc6e 0x5f0a29 0x5f3922 0x69dfec 0x5eabc4 0x5eb311 0x2423 0x5b77b7 0x5b7da7 0x5b8fab 0x5ca315 0x5cb24b 0x5bccf8 0x18bfdf9 0x18bfad0 0x18d9bf5 0x18d9962 0x190abb6 0x1909f44 0x1909e1b 0x5b87da 0x5ba65c 0x20ed 0x2025)
libc++abi.dylib: terminate called throwing an exception
我的appdelegate
@class RootViewController;
@class DetailViewController;
@interface SplitViewAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
TOSplitViewController *splitViewController;
RootViewController *rootViewController;
DetailViewController *detailViewController;
IBOutlet UINavigationController *navRoot;
IBOutlet UINavigationController *navDetail;
}
@property (nonatomic, retain) UINavigationController *navRoot;
@property (nonatomic, retain) UINavigationController *navDetail;
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet TOSplitViewController *splitViewController;
@property (nonatomic, retain) IBOutlet RootViewController *rootViewController;
@property (nonatomic, retain) IBOutlet DetailViewController *detailViewController;
@end
navRoot已连接到RootView,这是一个UINavigationController
问题是我真的需要为IOS4-6做这项工作,到目前为止一切都很完美。有人可以帮忙吗?感谢
答案 0 :(得分:1)
检查包含RootViewController
的xib或情节提要文件。可能性是您在视觉上与名为navRoot
的出口连接的内容在您的代码中实际存在。
答案 1 :(得分:0)
您看到此异常的原因是.xib加载时,它试图在某个实际上没有实现该属性的对象上设置navRoot
属性。通常,当您在编辑.xib时更改对象的类时会发生这种情况,但忘记检查其连接。查看.xib内部,看看是否可以找到任何无效连接的对象。