• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Possible bug in NSCalendarDate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Possible bug in NSCalendarDate
      • From: Jeremy Dronfield <email@hidden>
References: 
 >Possible bug in NSCalendarDate (From: Jeremy Dronfield <email@hidden>)

  • Prev by Date: Re: Possible bug in NSCalendarDate
  • Next by Date: Re: Simple File Data Reading Question
  • Previous by thread: Re: Possible bug in NSCalendarDate
  • Next by thread: Re: Possible bug in NSCalendarDate
  • Index(es):
    • Date
    • Thread