我对这个 Objective-C 编程完全陌生。我最近正在制作一个非常简单的应用程序,当我尝试在第二个控制器视图中定义 UI 项时,我找不到为什么该应用程序不起作用。我不断收到此错误消息:
“2013-08-04 02:38:45.488 Cheerup[43957:c07] * 由于未捕获的异常 'NSUnknownKeyException' 导致应用程序终止,原因:'[ setValue:forUndefinedKey:]:此类不符合键的键值编码欢迎留言。* First throw call stack: (0x1c91012 0x10cee7e 0x1d19fb1 0xb7ae41 0xafc5f8 0xafc0e7 0xb26b58 0x230019 0x10e2663 0x1c8c45a 0x22eb1c 0xf37e7 0xf3dc8 0xf3ff8 0xf4232 0xffc25 0x2ff3a3 0xfcee3 0xfd167 0xfd1a7 0x4690a2 0x45ab99 0x45ac14 0x10e2705 0x162c0 0x16258 0xd7021 0xd757f 0xd66e8 0x45cef 0x45f02 0x23d4a 0x15698 0x1becdf9 0x1becad0 0x1c06bf5 0x1c06962 0x1c37bb6 0x1c36f44 0x1c36e1b 0x1beb7e3 0x1beb668 0x12ffc 0x282d 0x2755)libc++abi.dylib:终止调用抛出异常(lldb)“
Appdeligate 有问题吗?
以下是我的两个 ViewController:
菜单视图控制器.h
#import <UIKit/UIKit.h>
@interface MenuViewController : UIViewController{
}
@property IBOutlet UIButton *Botton1;
@property IBOutlet UIButton *Botton2;
@end
菜单视图控制器.m
#import "MenuViewController.h"
@interface MenuViewController ()
@end
@implementation MenuViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
AfterMenuViewController.h
#import <UIKit/UIKit.h>
@interface AfterMenuViewController : UIViewController{
IBOutlet UILabel *WelcomeMsg;
IBOutlet UIButton *Back;
}
@end
AfterMenuViewController.m
#import "AfterMenuViewController.h"
@interface AfterMenuViewController ()
@end
@implementation AfterMenuViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
有什么想法吗?谢谢卡米亚