NSCalendarDate Problem

Discussion in 'iOS Programming' started by forrestgrant, Jul 31, 2008.

  1. macrumors member

    Joined:
    Jun 24, 2008
    #1
    When I set this variable:
    Code:
    NSCalendarDate *calInfo = [NSCalendarDate date];
    
    I get this error when I try to build:
    Code:
    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

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #2
    NSCalenderDate is not supported on the iPhone, you have to use NSDate.
     
  3. thread starter macrumors member

    Joined:
    Jun 24, 2008
    #3
    THIS is why Apples development program is a load of crap. Some emulator they have... supporting unavailable Classes.
     
  4. thread starter macrumors member

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

    Ideas?
     
  5. macrumors 65816

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #5
    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