my NSDateFormatter works only in the iPhone simulator
- by Manuel Spuhler
I use a NSDateFormatter which works fine in the simulator, but I get a nil when I run it in the iPhone. I hardcoded the date to be sure of the format, but it fails anyway.
NSString *strPubDate = @"Fri, 8 May 2009 08:08:35 GMT";
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
[dateFormatter setDateFormat:@"EEE, d MMM yyyy HH:mm:ss Z"];
NSDate *myDate = [dateFormatter dateFromString:strPubDate];
I tried with different region settings, languages etc. on the iPhone. Any idea what is going wrong?