-1

I am brand new to iOS/Objective-C and I am trying to learn. I am following along in Sam's Teach yourself iOS. I am doing a project called Hello Noun, where instead of displaying Hello World, it takes an input and displays "Hello Input".

Working on the project, everything was fine, and there were no errors. But when I went to Build and then Run the app, it crashed saying;

'NSUnknownKeyException', reason: '[<ViewController 0xa064620> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key setOutput.'

and pointed to main.m file highlighting these lines;

#import <UIKit/UIKit.h>

#import "AppDelegate.h"

int main(int argc, char * argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

The rest of the code used is below;

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

I am new to this, and I'm just getting my bearings so I'm not quite sure what is happening. Any help would be beyond appreciated.

user1804592
  • 137
  • 3
  • 11

1 Answers1

0

Go to your ViewController xib/Storyboard right click on the File's Owner you should find a yellow alert icon there delete that connection , it should solve your problem.

Bonnie
  • 4,943
  • 30
  • 34