Reputation: 111
I am kinda new to programming and not sure what I did here but I was setting up a new VC class and accidently replaced the standard VC which is automatically set up in my storyboard upon building a new Project This is the first VC which is displayed .h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
here is the .m
#import "ViewController.h"
@interface ViewController ()
@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.
}
@end
All that this VC has is one button which goes to the next screen but it crashes now as soon as it is launched with this error.
Terminating app due to uncaught exception 'NSUnknownKeyException',
reason: '[<ViewController 0x7575ee0> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key go.'
Is there anyway I can get this working without starting it all again? As it is a large program now .
Upvotes: 0
Views: 92
Reputation: 47049
This Error mostly Generated when By Mistake/Accidently remove/forget connection of you IBOutlet
to File's Owner
.
OR
If in XIB
file that is linked to a property IBOutlet
or method IBAction
in your view controller, and you have either deleted or renamed the property or method, the runtime can't find it because it has been renamed and therefore crashes.
Check your references of your IBOutlet
And method IBAction
in your XIB
that does not exist anymore.
Upvotes: 1
Reputation: 2306
Ok, the problem seems to be that you've hooked up an outlet in interface builder called "go", and then changed the view controller class in the storyboard.
This means that in IB there is still a reference to "go", but your current viewcontroller does not know about it.
Two solutions (depending on what you want to achieve)
Solution 1
If you want to use your ViewController
- go in to IB and change the Class
of the viewcontroller. Like so:
(The class should be "ViewController" in your case)
Solution 2
Select the viewcontroller in the storyboard and remove the outlet connection.
Upvotes: 0