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

Liam Herbert
15,140 PointsRefactoring code challenge
Hi I'm not have any success with the second stage of the challenge I don't understand what is wrong with my code. So here's my code any help will be greatly appreciated.
#import "Quote.h"
@implementation Quote
(NSArray *) quotes {
_quotes = [[NSArray alloc] initWithObjects:@"11",@"22",@"33", nil];
return _quotes;
}
(NSString *) randomQuote {
return @"Some Quote";
}
@end
The error message I get after running the code says "Bummer! Remember to allocate and initialize the instance variable '_quotes' and return it from the method named 'quotes'."
This is the link for the challenge link
Thanks,
Liam
1 Answer

Amit Bijlani
Treehouse Guest TeacherNot sure why you have hyphens "-" missing from your method names. You also need an if
statement to check to see if _quotes
is nil
.
Edit: Have you added the quotes
property to the header file?
Liam Herbert
15,140 PointsLiam Herbert
15,140 PointsYes I have added the quotes property to the header file this is what I put for the first stage of the challenge:
@property (strong, nonatomic) NSArray *quotes;
Liam Herbert
15,140 PointsLiam Herbert
15,140 PointsThank you Amit for your help. With your pieces of knowledge I mange to solve the second challenge
Thanks again, Liam
Amit Bijlani
Treehouse Guest TeacherAmit Bijlani
Treehouse Guest TeacherGlad you got it working!
Liam Herbert
15,140 PointsLiam Herbert
15,140 PointsYes, Thanks Amit.