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 trialMatthew Turrigiano
8,705 Pointscreating a custom class part 2
// for some reason this won't work //Quote.m
import "Quote.h"
@implementation Quote
-
(NSArray *) quotes{
if (_quotes == nil){
_quotes = [[NSArray alloc] initWithObjects:@"oneo",@"two", @"three", nil]; }return _quotes; }
@end
2 Answers
Stone Preston
42,016 Pointsdid you delete the randomQUote method that was already there? I tried using your code but left the randomQuote method there and passed:
#import "Quote.h"
@implementation Quote
- (NSArray *) quotes {
if (_quotes == nil){
_quotes = [[NSArray alloc] initWithObjects:@"oneo",@"two",
@"three",
nil];
}
return _quotes;
}
- (NSString *) randomQuote {
return @"Some Quote";
}
@end
M T
11,934 PointsI had the same problem, Matthew.
Make sure you don't have the @property set to "readonly". You would have passed challenge task 1 if you included "readonly", but would not be able to pass challenge task 2 by trying to set a value to something that is readonly.