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
Brenden Konnagan
16,858 PointsHelp with Designated Initializers and Convenience... Quiz
The question just asks: "Fill in the blank below:"
- ( ? ) initWithSinger:(NSString *)singer { ? = [ ? init]; if ( ? ) { _singer = singer; } return ?; } so this is what I have:
- ( id) initWithSinger:(NSString *)singer { self = [ ? init]; (not sure here because I have no clue what this class is........) if ( self ) { _singer = singer; } return self; }
Please help me figure out what this quiz is looking for for the class to init. :-)
Thanks!
Brenden Konnagan
16,858 PointsIt is under: iOS: Blog Reader: Data Modeling: Designated Initializers and Connivence Constructors : Quiz
1 Answer
Nic Huang
Courses Plus Student 10,573 PointsHello! it should be - ( id ) initWithSinger:(NSString *)singer{
self = [super init];
if ( self ){
_singer = singer;
}
return self
}
Brenden Konnagan
16,858 Pointsthank you! I was getting hung up on the class forgetting I should be able to just call super!
Aaron Daub
Courses Plus Student 96 PointsYou should be using instancetype for initializers now.
Kai Aldag
Courses Plus Student 13,560 PointsKai Aldag
Courses Plus Student 13,560 Pointswhich quiz is this.