日期格式化程序在运行相同iOS版本的不同设备上的不同输出 [英] date formatter different output on different devices running same iOS version
问题描述
NSDate *currentDate = [NSDate date];
NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"MM/dd/yyyy,h,mm,a"];
NSString *dateString = [format stringFromDate:currentDate];
[format release];
NSLog(dateString);
在以下设备中输出:设备iPhone4
[240:707] 2011/10/25,22,23,
当前语言:自动;目前的目标-c
警告:无法读取/SDK4.2/Platforms/iPhoneOS.platform/DeviceSupport/4.3.3(8J2)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib
Output in: Device iPhone4
[240:707] 10/25/2011,22,23,
Current language: auto; currently objective-c
warning: Unable to read symbols for /SDK4.2/Platforms/iPhoneOS.platform/DeviceSupport/4.3.3 (8J2)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib
在以下设备中输出:设备iPad2
[82:707] 2011/10/25,12,28,PM
当前语言:自动;目前的目标-c
警告:无法读取/SDK4.2/Platforms/iPhoneOS.platform/DeviceSupport/4.3.3(8J2)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib的符号
这个东西在所有人的模拟器上都可以正常工作.
Output in: Device iPad2
[82:707] 10/25/2011,12,28,PM
Current language: auto; currently objective-c
warning: Unable to read symbols for /SDK4.2/Platforms/iPhoneOS.platform/DeviceSupport/4.3.3 (8J2)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib
This thing works fine on Simulator for all.
如何处理?
更多信息:
还需要注意的是,相同的格式化字符串会导致返回12小时和24小时时钟值
More Info:
it is also to notice that the same formatting string resulting in 12 hr and 24 hr clock values in return
推荐答案
最终解决了它. 这是由于手机中将其设置为24小时制.
finally resolved it. it was due to the settings in phone as 24 Hr clock.
我必须相应地更新代码.
I had to update my code accordingly.
:)
这篇关于日期格式化程序在运行相同iOS版本的不同设备上的不同输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!