Nat! bio photo

Nat!

Senior Mull.

Twitter RSS

Github

Annoying NSDateFormatter now wrongly complains by default

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{
   NSDateFormatter     *formatter;
   NSAutoreleasePool  *pool;
   
   pool = [NSAutoreleasePool new];
   
   formatter = [[[NSDateFormatter alloc] initWithDateFormat:@"%Y %m %d"
                                       allowNaturalLanguage:YES] autorelease];
   NSLog( @"%ld", [formatter formatterBehavior]);
   NSLog( @"%@", [formatter stringForObjectValue:[NSDate date]]);
   
   [pool release];
   return 0;
   
}

output:

2013-10-29 14:29:42.816 GehtHierUberhauptNochWas[3029:303] 1000
2013-10-29 14:29:42.818 GehtHierUberhauptNochWas[3029:303] 10.4-style NSDateFormatter method called on a 10.0-style formatter, which doesn't work. Break on _NSDateFormatter_Log_New_Methods_On_Old_Formatters to debug. This message will only be logged once.
2013-10-29 14:29:42.822 GehtHierUberhauptNochWas[3029:303] 2013 10 29
Program ended with exit code: 0

- (NSString *) stringForObjectValue:(id) value; has been there since the dawn of time.