我是iOS開發的小菜鳥,所以我遵循HelloWorld教程here。我已經到了我在添加按鈕,文本字段和標籤後測試應用程序的階段。據我所知,我已經跟着教程去了信,我在運行應用時遇到了這個錯誤:Apple的HelloWorld教程中的NSUnknownKeyException
2013-07-13 15:26:39.629 HelloWorld [1304:11303] *終止應用程序由於 未捕獲的異常「NSUnknownKeyException」,原因: 「[< HelloWorldViewController 0x7566000>的setValue:forUndefinedKey:]: 這類不是密鑰值編碼兼容的鍵標籤」。 *第一擲調用堆棧:(0x1c90012 0x10cde7e 0x1d18fb1 0xb79e41 0xafb5f8 0xafb0e7 0xb25b58 0x22f019 0x10e1663 0x1c8b45a 0x22db1c 0xf27e7 0xf2dc8 0xf2ff8 0xf3232 0x423d5 0x4276f 0x42905 0x4b917 0xf96c 0x1094b 0x21cb5 0x22beb 0x14698 0x1bebdf9 0x1c13f3f 0x1c1396f 0x1c36734 0x1c35f44 0x1c35e1b 0x1017a 0x11ffc 0x1f9d 0x1ec5) 的libc + + abi.dylib:終止稱爲拋出異常
在HelloWorldViewController.m
生成的代碼是:
#import "HelloWorldViewController.h"
@interface HelloWorldViewController()
@property (weak, nonatomic) IBOutlet UILabel *label;
@property (weak, nonatomic) IBOutlet UITextField *textField;
- (IBAction)changeGreeting:(id)sender;
@end
@implementation HelloWorldViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)changeGreeting:(id)sender {
}
@end
而在HelloWorldViewController.h
:
#import <UIKit/UIKit.h>
@interface HelloWorldViewController : UIViewController
@end
我嘗試使用this的答案,但我看不到一個XIB文件(我想是因爲我使用的是故事板?),我不能看到任何VC差異明顯。
請幫忙。
[此類不是密鑰的關鍵值編碼兼容](http://stackoverflow.com/questions/3088059/this-class-is-not-key-value-coding-compliant-for -key) – jtbandes