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

Shaun Kelly
Shaun Kelly
5,648 Points

Self?

So self refers to the particular instance of that class. So if the class is a subclass of NSObject. When i refer to self within that class i'm referring to NSObject in this case ?

Jayden Spring
Jayden Spring
8,625 Points

No, if you called super you were.

When you call self you are referring to anything within the braces ({ }) for that class.

1 Answer

Shaun Kelly
Shaun Kelly
5,648 Points

So in this example am I referring to NSString and is there any other documentation or further information about this ?....

#import "BlogPost.h"

@implementation BlogPost


-(id) initWithTitle:(NSString *)title{

    self = [super init];


    if (self) {
        self.title = title;


    }

    return self;   
}
Jayden Spring
Jayden Spring
8,625 Points

Can you post your BlogPost.h please so we can see the super class. What you are doing seems unclear.