Re: Compiler Warning: 'NSDate' may not respond to '+dateWithTimeInterval:sinceDate:'
Re: Compiler Warning: 'NSDate' may not respond to '+dateWithTimeInterval:sinceDate:'
- Subject: Re: Compiler Warning: 'NSDate' may not respond to '+dateWithTimeInterval:sinceDate:'
- From: Philip Mobley <email@hidden>
- Date: Fri, 26 Mar 2010 13:05:05 -0700
On Mar 26, 2010, at 1:23 AM, Alec Stewart wrote:
> This compiler warning " 'NSDate' may not respond to
> '+dateWithTimeInterval:sinceDate:' "is driving me up the wall.
>
> I don't understand why I am getting the warning because, by all indications,
> +dateWithTimeInterval:sinceDate: has not been deprecated.
>
> I would be extremely grateful for any insight.
>
>
> Here's my code:
>
> NSDate *dateWithoutHundredths;
>
> dateWithoutHundredths = [NSDate dateWithString:[NSString
> stringWithFormat:@"d-d-d d:d:d +0000", year, month, day,
> hour, minutes, seconds]];
>
> NSTimeInterval hundredthsToAdd = (double)(hundredth / 100.0);
>
> date = [NSDate dateWithTimeInterval:hundredthsToAdd
> sinceDate:dateWithoutHundredths]; //This is the line the warning shows up on
Tech notes say:
+ (id)dateWithTimeInterval:(NSTimeInterval)secondssinceDate:(NSDate *)date
Is only available in OS X 10.6 and higher. If your compiler Base SDK is set for 10.5, then that is probably the issue.
As an alternative, you can use a 10.0 compatible function:
- (id)initWithTimeInterval:(NSTimeInterval)seconds sinceDate:(NSDate *)refDate_______________________________________________
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