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

iOS Build a Blog Reader iPhone App Data Modeling Designated Initializers and Convenience Constructors

Randall Whitman
Randall Whitman
3,954 Points

Cant seem to get this one on the quiz

I believe it should be

  • (id) initWithSinger:(NSString *)singer { return [[self alloc] initWithSinger:singer]; }

Am i missing something?

2 Answers

Patrick Donahue
Patrick Donahue
9,523 Points

I believe you should be returning self. If you look below you can see that you can't return the method in itself. That is what you are doing.

return self;

-(id) initWithTitle:(NSString *)title
{
    self = [super init];
    if (self) {
        self.title = title;
        self.author = nil;
        self.thumbnail = nil;
    }

    return self;
}

+(id) blogPostWithTitle:(NSString *)title
{
    return [[self alloc] initWithTitle:title];
}