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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Misha Shaposhnikov](https://uploads.teamtreehouse.com/production/profile-photos/1045192/micro_Profile_Pic.jpg)
Misha Shaposhnikov
8,718 PointsUsing Custom Class Quiz
In the iOS Track, for the Blog Reader app, under the Achievement Data Modeling, the last quiz is giving me trouble. I can't solve the question that asks to use a convenience constructor. Isn't this the right way?
Song *someSong = [Song songWithSinger: @"James Brown"];
2 Answers
![J Andrew Scott](https://secure.gravatar.com/avatar/279ea07b2db90bd5493bcb2784f75c8e?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
J Andrew Scott
30,626 PointssongWithSinger:
is actually a factory method. It gets called on the class as a whole. Constructors are called on newly allocated instances of the class. I'm guessing the constructor would look something like this:
Song *someSong = [[Song alloc] initWithSinger:@"James Brown"];
![Misha Shaposhnikov](https://uploads.teamtreehouse.com/production/profile-photos/1045192/micro_Profile_Pic.jpg)
Misha Shaposhnikov
8,718 PointsMy original post was correct. A convenience constructor takes care of allocating memory and returning an instance all in one method call. J Andrew Scott's post is called a designed initializer. You still have to call alloc to allocate memory but you can initialize and assign values to an object with the same method call.
As for the quiz, there seems to be a bug with the Treehouse quick-checker. Just remove the space between the colon after songWithSinger and the @ symbol and it should work. like this:
Song *someSong = [Song songWithSinger:@"James Brown"];
Brett Kim
11,576 PointsBrett Kim
11,576 Pointsdidn't work for me...