【发布时间】:2013-11-20 12:15:35
【问题描述】:
我在获取 iOS 6 NSDate 对象中星期几的全名时遇到问题(在 iOS 7 中工作正常)。 我在 stackoverflow 上搜索过类似的问题,但没有找到我想要的。
我的测试用例是:
formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"EEEE"];
[formatter setDoesRelativeDateFormatting:NO];
NSDate *testDate = [NSDate dateWithTimeIntervalSince1970:1384551041.389218];
NSLog(@"%@",[formatter stringFromDate:testDate]);
预期的输出是Friday(本地化为您的设备区域格式和公历),它适用于iOS 7,但在iOS 6 上它返回一个空描述。我已经在具有相同区域格式集的实际设备中进行了测试。
据我所知,iOS 6 根据this documentation 使用tr35-25 格式,EEEE 以该格式指定星期几的全名。
我错过了什么吗?
【问题讨论】:
标签: iphone objective-c ios6 nsdateformatter dayofweek