PDA

View Full Version : NSCalendarDate Problem




forrestgrant
Jul 31, 2008, 12:26 PM
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?



MacDonaldsd
Jul 31, 2008, 02:14 PM
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?

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

forrestgrant
Aug 1, 2008, 08:37 AM
THIS is why Apples development program is a load of crap. Some emulator they have... supporting unavailable Classes.

forrestgrant
Aug 1, 2008, 08:45 AM
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.

Ideas?

MacDonaldsd
Aug 2, 2008, 02:07 PM
This would set calInfo equal to 08. NSDate does not respond to setCalendarFormat.

Ideas?

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.