Hello,

  I'm not getting why this is not working:

 NSDate *date = [NSDate date];

 NSDateFormatter *df1 = [[NSDateFormatter alloc] initWithDateFormat:@"EEE d" 
allowNaturalLanguage:NO]; 
 NSString *s1 = [df1 stringFromDate:date];

s1 ---> @"EEE d";

 NSDateFormatter *df2 = [[NSDateFormatter alloc] init];
 [df2 setDateFormat:@"EEE d"]; 
 NSString *s2 = [df2 stringFromDate:date];

s2 ---> @"Sat 19"  (on a Saturday the 19th)

I could live with that but the documentation tells me that -init is deprecated 
in 10.6? Is that really true? When I look at the NSDateFormatter header things 
look quite differently:

#if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE))
@interface NSDateFormatter (NSDateFormatterCompatibility)

- (id)initWithDateFormat:(NSString *)format allowNaturalLanguage:(BOOL)flag;
- (BOOL)allowsNaturalLanguage;

@end
#endif

Which to me tries to convey that -initWithDateFormat: is deprecated -- not by 
saying so directly of course.

So who is wrong, docs or header? And why doesn't the -initWithDateFormat: 
initializer work?

Puzzled
Markus
--
__________________________________________
Markus Spoettl

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to