Re: Possible bug in NSCalendarDate
Re: Possible bug in NSCalendarDate
- Subject: Re: Possible bug in NSCalendarDate
- From: Shawn Erickson <email@hidden>
- Date: Wed, 11 Feb 2004 11:08:19 -0800
On Feb 11, 2004, at 10:36 AM, Jeremy Dronfield wrote:
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?
Something else must be going wrong (or some funky compiler/optimizer
bug which very unlikely)...
What you are doing in the second implementation is identical to the
first from the point of view of the initWithString:calendarFormat:
message.
When you get a nil back what does pathDate point at? Is it nil? If not
does the string look like what you expect?
-Shawn
_______________________________________________
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.