Re: Possible bug in NSCalendarDate
Re: Possible bug in NSCalendarDate
- Subject: Re: Possible bug in NSCalendarDate
- From: Eric Forget <email@hidden>
- Date: Wed, 11 Feb 2004 14:02:13 -0500
>
I've come across a strange issue when initializing an NSCalendarDate
>
from a string passed through a method argument. If I do this:
>
>
- (void)displayEntryForPath:(NSString *)path withDate:(NSString
>
*)pathDate
>
{
>
NSCalendarDate *currentDate;
>
currentDate = [[NSCalendarDate alloc] initWithString:pathDate
>
calendarFormat:@"%Y/%B/%d %A"];
>
[...etc]
>
}
>
>
I get a nil date. However, if I create a new pointer to the string like
>
so:
>
>
- (void)displayEntryForPath:(NSString *)path withDate:(NSString
>
*)pathDate
>
{
>
NSCalendarDate *currentDate;
>
NSString *dateString = pathDate;
>
currentDate = [[NSCalendarDate alloc] initWithString:dateString
>
calendarFormat:@"%Y/%B/%d %A"];
>
[...etc]
>
}
>
>
the date is initialized normally. Is this a bug, or am I missing some
>
elementary yet arcane nuance in Obj-C?
Jeremy,
To me it looks like for your two test cases, pathData didn't have the save
value. Add something like the following in both case while your are running
it:
NSLog(pathDate);
currentDate = [[NSCalendarDate alloc] ...
Eric
___________________________________________________________________
Eric Forget Cafederic
email@hidden <
http://www.cafederic.com/>
Fingerprint <86D5 38F5 E1FD 5D9C 71C3 BAA3 797E 70A4 6210 C684>
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.