Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Jamie Baker
Jamie Baker
5,703 Points

why is my code producing the error 'use of undeclared identifier '_predictions' when I have done exactly as instructed?

syntax:

@implementation

  • (NSArray *) predictions { if (_predictions == nil) { _predictions = [[NSArray alloc] initWithObjects: @"It is certain", @"It is decidedly so", @"ALL signs say YES", @"The stars are not aligned", @"My reply is no", @"It is doubtful", @"Better not tell you now", @"Concentrate and ask again", @"Unable to answer now", nil]; } return _predictions; }

why is my code producing the error 'use of undeclared identifier '_predictions' ?

the video said that the instance variable of 'predictions' is denoted by '_predictions' but then it doesn't seem to recognise it in the implementation.

as instructed, I also declared my property variable for predictions, and the video says this automatically results in the activation of '_predictions'.

1 Answer

What does your property declaration look like in the Header file?