我是 iOS 开发的菜鸟,所以我在这里学习 HelloWorld 教程。添加按钮、文本字段和标签后,我已经到了测试应用程序的阶段。据我所知,我已按照教程进行操作,并且在运行应用程序时出现此错误:
2013-07-13 15:26:39.629 HelloWorld[1304:11303] * 由于未捕获的异常“NSUnknownKeyException”而终止应用程序,原因:“[<HelloWorldViewController 0x7566000> setValue:forUndefinedKey:]:此类不符合键值编码为关键标签。* First throw call stack: (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: terminate称为抛出异常
中生成的代码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
我尝试使用这个答案,但我看不到 XIB 文件(我想是因为我使用的是故事板?)而且我在 VC 中看不到任何明显的差异。
请帮忙。