cocoa - Incompatible pointer type with NSDate -
i can't see why doesn't work. following code block throws warning @ addobject line: "passing argument 1 of 'taskwithtext:duedate:' incompatible pointer type"
- (id)init{ self = [super init]; if (self) { tasklistarray = [[nsmutablearray alloc] init]; [tasklistarray addobject:[afltask taskwithtext:"@helloski" duedate:[nsdate datewithnaturallanguagestring:@"12/31/12"]]]; } return self; }
it's simple don't see why doesn't work. seems match method:
- (id)initwithtext:(nsstring *)newtext duedate:(nsdate *)newduedate{ if(self = [super init]){ tasktext = [newtext retain]; taskdue = [newduedate retain]; taskcompleted = no; } return self; } + (id)taskwithtext:(nsstring *)newtext duedate:(nsdate *)newduedate{ return [[[afltask alloc] initwithtext:newtext duedate:newduedate] autorelease]; }
what going on here? i'm pretty new objective-c (but not programming in general) , i'm still trying wrap head around pointers -- shouldn't work?
you're going kick yourself:
"@helloski"
should be
@"helloski"
Comments
Post a Comment