It runs at first but then goes back to an error. This is what the log says
"2014-01-26 17:43:23.264 Higher or Lower[26812:70b] * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key enter.'"
#import "ViewController.h"
int answer = 0;
int guess = 0;
int turn = 0;
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad; {
[super viewDidLoad];
_higher.hidden = YES;
_lower.hidden = YES;
answer = arc4random() % 100 + 1;
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[_labelGuess resignFirstResponder];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)enterButton:(UIButton *)sender {
NSString *input = _labelGuess.text;
guess = [input intValue ];
_labelGuess.text=input;
if (guess > answer) {
_lower.hidden = NO;
_higher.hidden = NO;
}
else if (guess < answer) {
_lower.hidden = YES;
_higher.hidden = NO;
}
else {
NSLog(@"Correct! The answer was %i", answer);
}
NSLog(@"The random value is %i", answer);
scanf("%i", &guess);
}
@end
//HEADER FILE!
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITextField *labelGuess;
@property (weak, nonatomic) IBOutlet UIImageView *chooseNumber;
@property (weak, nonatomic) IBOutlet UIImageView *higher;
@property (weak, nonatomic) IBOutlet UIImageView *lower;
- (IBAction)enterButton:(UIButton *)sender;
@end