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

Challenge task 2 of 3 Switch to the implementation file and implement a 'quotes' method which will allocate and initial

import "Quote.h"

@implementation Quote

  • (NSString *) randomQuote { if(_quotes ==nil) { _quotes= [[NSArry alloc]initWithObjects:@"a",@"b",@"c",nil]; }

    return _quotes; }

I recheck again and again ,and I don't know why it's not right

1 Answer

Marcus Davajon
Marcus Davajon
6,882 Points
  • (NSArray *) randomQuote{

    if (_quotes == nil) {

    _quotes = @[@"a", @"b", @"c"];
    

    }

    return _quotes;

}

I passed with this. Now I noticed that your NSArray was misspelled as "NSArry".... It won't allow you to pass if any keys are missing or words misspelled. I've spend a lot time for the same reasons! It's just part of it :)