Question about laterDate: and earlierDate:
Question about laterDate: and earlierDate:
- Subject: Question about laterDate: and earlierDate:
- From: Paul Bruneau <email@hidden>
- Date: Tue, 16 Oct 2007 08:39:35 -0400
Hi-
I'm a big fan of laterDate: and earlierDate:.
I use them with NSCalendarDate objects even though the methods belong
to NSDate because NSCalendarDate is a subclass of NSDate and so I
should be able to it seems.
And it seems to work fine, but I do get a compiler warning of:
"warning: passing argument 1 of 'setStartTime:' from distinct
Objective-C type"
Here is my code example:
[selectedOS setStartTime:[testedStartTime laterDate:now]]; //this
line gives the warning
- (void)setStartTime:(NSCalendarDate *)newStartTime //this is the
method I am calling
{
[newStartTime retain];
[startTime release];
startTime = newStartTime;
}
startTime is an NSCalendarDate ivar.
testedStartTime is an NSCalendarDate object locally defined.
now is an NSCalendarDate ivar.
So the compiler seems like it's mad that [testedStartTime
laterDate:now] returns an NSDate maybe instead of an NSCalendarDate?
Do I have to use id in my setStartTime: method to prevent this
warning? It seems like I shouldn't have to due to NSCalendarDate
having inherited the methods from NSDate...
Thank you in advance
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden