对于密钥XXXXXX,此类不符合密钥值编码

Luc*_*uca 10 interface-builder uiviewcontroller ios

当我尝试构建并运行我的应用程序时,它崩溃了,我在日志中得到了这个:

reason: '[<LoadingViewController 0x6b2c5a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key aproposViewController.'
Run Code Online (Sandbox Code Playgroud)

奇怪的aproposViewController是没有使用LoadingViewController它,它只是我的应用程序中的另一个视图控制器.请帮忙,提前thx :)

编辑

appdelegate.h:

@class LoadingViewController;

@interface TopStationAppDelegate : NSObject <UIApplicationDelegate,CLLocationManagerDelegate> {
    UIWindow *window;
    LoadingViewController *loadingView;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet LoadingViewController *loadingView;
@end
Run Code Online (Sandbox Code Playgroud)

appdelegate.m:

#import "LoadingViewController.h"
@implementation TopStationAppDelegate
@synthesize window;
@synthesize loadingView;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
  [window addSubview:loadingView.view];
    [window makeKeyAndVisible];
    return YES;
}
- (void)dealloc {
    [loadingView release];
    [window release];
    [super dealloc];
}
@end
Run Code Online (Sandbox Code Playgroud)

没有aproposViwController的声明,即使在主视图的IB中也是如此! 编辑2 这里有两个主屏幕截图和主界面中的loadingView: 在此输入图像描述

在此输入图像描述

kba*_*all 28

无法确定这是否是您所遇到的情况,但如果您在笔尖中设置了连接以将对象分配给另一个对象的属性,则通常会看到此消息,但该属性在目标对象.

所以你可能在一个点上有一个名为aproposViewController的IBOutlet,在一个点上连接了另一个视图控制器,然后删除了IBOutlet但忽略了删除nib中的连接.

因此,当加载nib时,它会尝试设置属性,但只发现它不存在,因此:

reason: '[<LoadingViewController 0x6b2c5a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key aproposViewController.'
Run Code Online (Sandbox Code Playgroud)