NSCalendarDate Problem

Discussion in 'iPhone/iPad Programming' started by forrestgrant, Jul 31, 2008.

  1. macrumors member

    When I set this variable:
    NSCalendarDate *calInfo = [NSCalendarDate date];
    I get this error when I try to build:
    error: 'NSCalendarDate' undeclared (first use in function)
    Why is it treating it as a newly declared variable instead of the class that it is?
  2. macrumors 65816


    NSCalenderDate is not supported on the iPhone, you have to use NSDate.
  3. macrumors member

    THIS is why Apples development program is a load of crap. Some emulator they have... supporting unavailable Classes.
  4. macrumors member

    In that case... Here is what my NSCalendarDate was doing:
    	NSCalendarDate *calInfo = [NSCalendarDate date];
    	[calInfo setCalendarFormat:@"%y"];
    This would set calInfo equal to 08. NSDate does not respond to setCalendarFormat.

  5. macrumors 65816


    I expect you have already worked out that you should be using NSDateFormatter. I agree Apple are being a bit stupid about having classes work in the simulator, and not on the handset. If its any conciliation there deprecating NSCalendarDate in OS X as well.

Share This Page