0
我看不出为什么这不起作用。下面的代码块抛出的ADDOBJECT线警告:“传递的参数1‘taskWithText:的dueDate:’从兼容的指针类型”与NSDate不兼容的指针类型
- (id)init{
self = [super init];
if (self) {
taskListArray = [[NSMutableArray alloc] init];
[taskListArray addObject:[AFLTask taskWithText:"@Helloski" dueDate:[NSDate dateWithNaturalLanguageString:@"12/31/12"]]];
}
return self;
}
它是如此简单,我不明白为什么它不工作。它似乎符合我的方法:
- (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];
}
这是怎么回事?我对Objective-C非常陌生(但通常不是编程),所以我仍然试图围绕着指针 - 但是不应该这样工作?
哦男人。其中一个_。谢谢! – AFL 2011-05-11 03:30:19