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
Mark McCuller
3,539 PointsiOS Development Build a Blog Reader iPhone App Data Modeling Quiz
I can't get this question right (#1) and another question listed below(#2 ). (#1) How would you call a method to set the instance singer of a Song object to the singer James Brown? Fill in the Boxes. [song BOXES : BOXES ]; Should not the answer look like below,with song having double [[song? [[Song alloc] initWithSinger: @โJames Brownโ]; my answer is wrong on the quiz.
(#2) Add a getter method for the singer instance variable: @interface Song : NSObject { NSString *singer; } - (void) setSinger:(NSString *)_singer; - ( BOXES ) BOXES ; @end
For the Boxes I put in NSString * _singer so the line of code looks like below -(NSString *) _singer; this answer is wrong on the quiz also.
Please help me, thank you.
Mark
2 Answers
Amit Bijlani
Treehouse Guest TeacherQuestion 1. How would you call a method to set the instance singer of a Song object to the singer James Brown? Fill in the Boxes.
[song _______ : ______];
The question is asking how you would set the singer of the Song object. It's not asking you to create an instance of the Song object. Which means you would simply call the setSinger method and pass it the string literal @"James Brown".
Question 2. Add a getter method for the singer instance variable
The getter method is never prefixed with an underscore.
Mark McCuller
3,539 PointsAmit,
Thank you for your time on directing me on the right path, I got 6/6 correct on quiz. I'm a beginner to IOS programming and I appreciate your assistance and teaching at TreeHouse.
Best Regards,
Mark