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
Homer Denson
2,024 PointsTrouble with Blog Reader.
I just finished the Data Modeling section but when I run my application i get 2 errors both in my BlogPost.m .One is "Method definition for blogPostWithTitle not found" and the other is "Use of undeclared identifier blogPostWithTitle." not sure what to do
import "BlogPost.h"
@implementation BlogPost
-(id) initWithTitle: (NSString *)title { self = [super init];
if (self){
self.title = title;
}
return self;
+(id) blogPostWithTitle: (NSString *)title { return [[self alloc] initWithTitle: title; } }
@end
2 Answers
David Kaneshiro Jr.
29,247 PointsFrom what I can see it looks like you are missing a closing square bracket ']' right after the title argument within your blogPostWithTitle function.
This is what my code looks like
- (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];
}
Homer Denson
2,024 Pointsthank you, i was staring at the screen all day, and wasn't paying attention