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 trialFlorian Grummel
5,424 PointsWhy are these two answers wrong?
For the convenience constructor I typed the following code:
Song *popSong = [Song songWithSinger: @"James Brown"];
Relating to the video and a little test in xcode, this definition should work. But the quiz doesn't accept that..
Same issue for the initialiser initWithSinger. I typed:
Song *popSong = [[Song alloc] initWithSinger: @"James Brown"];
but this line is also not correct...
btw: i love your tutorials, you're doing a great job! ;)
2 Answers
Holger Liesegang
50,595 PointsHallo Florian,
Your solution for the second question "Create an instance of the Song class with the convenience constructor songWithSinger:(NSString *)s and singer named "James Brown"."
Song *popSong = [[Song alloc] initWithSinger:@"James Brown"];
seems IMHO to be correct.
Your answer for the third question "Create an instance of the Song class with the convenience constructor songWithSinger:(NSString *)s and singer named "James Brown"." seem to be ok, too:
Song *popSong = [Song songWithSinger:@"James Brown"];
I tested both answers and they ran through the Quiz. Maybe the quiz had some trouble with a space or semicolon? Try C&P my above answers (without the first part and the semicolon, of course) - does this work?
Florian Grummel
5,424 PointsHallo Holger,
Yes, it just worked fine. Thank you very much for your support :) Indeed your solution helped me solving this quiz even if I still have no idea what I did wrong. :D
the less you think about it the more it makes sense... but there might have been trouble using spaces between : and @
Holger Liesegang
50,595 PointsGern geschehen - your're welcome :)
Holger Liesegang
50,595 PointsHolger Liesegang
50,595 PointsFlorian Grummel I just edited my answer.