Mistake with Outlets in Book, I do not know what to do


#1

On Page 14 we are supposed to insert the following code:

[code]#import “BNRQuizViewController.h”

@interface BNRQuizViewController.h
@interface BNRQuizViewController ()

@property (nonatomic, weak) IBOutlet UILabel *questionLabel;
@property (nonatomic, weak) IBOutlet UILabel *answerLabel;

@end
@implementation
@end
[/code]

When I run that code, it says there are two things incorrect with the code,
I went to the forums and saw this solution:

[code]#import “BNRQuizViewController.h”

@interface BNRQuizViewController.h
@interface BNRQuizViewController ()

@property (nonatomic, weak) IBOutlet UILabel *questionLabel;
@property (nonatomic, weak) IBOutlet UILabel *answerLabel;

@end
@implementation BNQuizViewController
@end
[/code]

However, when I ran this, it said there was an error and I could not set the outlets.
What am I doing incorrectly?


#2

There are two problems.

I will let you spot them, by comparing yours to this:

#import "BNRQuizViewController.h"

@interface BNRQuizViewController ()
@property (nonatomic, weak) IBOutlet UILabel *questionLabel;
@property (nonatomic, weak) IBOutlet UILabel *answerLabel;
@end

@implementation BNRQuizViewController
@end

Always check your typing before you compile your code.

[Become a competent programmer faster than you can imagine: pretty-function.org]


#3

Gosh darnit, I re-typed the code, writing it incorrectly, here is it pasted:

#import "BNRQuizViewController.h"

@interface BNRQuizViewController ()

@property (nonatomic, weak) IBOutlet UILabel *questionLabel;
@property (nonatomic, weak) IBOutlet UILabel *answerLabel;
@end

@implementation BNRQuizViewController

@end

Thanks for the comment, I will compare b/w my actual one and yours!


#4

Agh! It all makes sense!

Thanks for the code, I confirmed it with mine, and found I was setting the outlets incorrectly!

I overreacted.

Thanks!