对于键setOutput ,此类不符合键值编码
我是iOS / Objective-C的新手,我正在努力学习。 我正在跟随Sam的自学iOS。 我正在做一个名为Hello Noun的项目,它不需要显示Hello World,而是接受输入并显示“Hello Input”。
在项目上工作,一切都很好,没有错误。 但当我去Build然后运行应用程序时,它崩溃了说;
'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key setOutput.'
并指向强调这些行的main.m文件;
#import #import "AppDelegate.h" int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } }
使用的其余代码如下;
ViewController.m
@interface ViewController () @property (weak, nonatomic) IBOutlet UILabel *userOutput; @property (weak, nonatomic) IBOutlet UITextField *userInput; - (IBAction)setOutput:(id)sender; @end @implementation ViewController - (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)setOutput:(id)sender { self.userOutput.text=self.userInput.text; } @end
我是新手,我只是得到了方向,所以我不太清楚发生了什么。 任何帮助都将无法理解。
转到你的ViewController
xib / Storyboard右键单击File's Owner
你应该找到一个黄色警报图标删除那个连接,它应该解决你的问题。
- swift println()在写代码时没有显示自动完成选项
- iOS,CloudKit – 当我的应用程序启动时,我需要做一个抓取吗?
- 在iOS上实时录制,修改音高和播放音频
- 在UICollectionView中search和过滤单元格
- 在关闭内部调用Swift Closure
- 如何使用加速计在iphone屏幕上的油漆?
- Swift 3 Decimal,NSDecimal和NSDecimalNumber
- 通过JavaScript打开应用程序(iOS / Android),并将回退redirect到App / Play商店(2016年版)
- 如何在UITableView中将UITableViewCell Image更改为Circle