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 Build a Simple iPhone App (iOS7) Refactoring into a Model Creating a Custom Class

Zdeněk Zemek
Zdeněk Zemek
4,430 Points

My mistake

Hello all, I have small problem. I am not able to finish training because in one of the practice it still saying me. that I did mistake. But I am not sure where the mistake is :(.

I is in stage 4.

So the task si: Switch to the implementation file and implement a 'quotes' method which will allocate and initialize the _quotes instance variable only if it is 'nil'. Initialize the array with any three strings.

I wrote:

  • (NSArray *) quote { if (_quotes == nil){ _quotes = [[NSArray alloc] initWithObjects:@"first",@"second",@"third", nil]; } return _quotes; }

So and control system wrote me>

Bummer! Remember to allocate and initialize the instance variable '_quotes' and return it from the method named 'quotes'.

I do not know, what i am doing wrong....

Can anyone help me pls?

3 Answers

This might help you question was asked recently on the forum - https://teamtreehouse.com/forum/code-challenge-creating-a-custom-class-3

'quotes' not quote your code has (NSArray *) quote

Switch to the implementation file and implement a 'quotes' method which will allocate and initialize the _quotes instance variable only if it is 'nil'. Initialize the array with any three strings.

Zdeněk Zemek
Zdeněk Zemek
4,430 Points

Yeah.. thank you so much :-) - Problem is solved :-)