Ios NSDateformatter在iPhone MD269LL型号上始终返回为零,但在其他型号上返回为OK

Ios NSDateformatter在iPhone MD269LL型号上始终返回为零,但在其他型号上返回为OK,ios,xcode,nsdateformatter,Ios,Xcode,Nsdateformatter,我遇到了一个问题,当在iPhone型号MD269LL上运行时,NSDateformatter总是为下面的所有NSDate变量返回nil,到目前为止已在iOS5.x上进行了测试,但在iOS4.3~5.1的其他型号上仍然正常 NSDateFormatter *formatterTime = [[NSDateFormatter alloc] init]; NSDateFormatter *formatterTime2 = [[NSDateFormatter alloc] init]; NSDateFo

我遇到了一个问题,当在iPhone型号MD269LL上运行时,NSDateformatter总是为下面的所有NSDate变量返回nil,到目前为止已在iOS5.x上进行了测试,但在iOS4.3~5.1的其他型号上仍然正常

NSDateFormatter *formatterTime = [[NSDateFormatter alloc] init];
NSDateFormatter *formatterTime2 = [[NSDateFormatter alloc] init];
NSDateFormatter *formatterTime3 = [[NSDateFormatter alloc] init];
NSDateFormatter *formatterTime4 = [[NSDateFormatter alloc] init];

[formatterTime2 setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate *temp1 = [formatterTime2 dateFromString:@"2012-03-22 22:01:01"];

[formatterTime3 setDateFormat:@"yyyy-MM-dd HH:mm:ss zzz"];
NSDate *temp2 = [formatterTime3 dateFromString:@"2011-03-21 20:35:03 GMT+8"];

[formatterTime4 setDateFormat:@"yyyy-MM-dd h:mm a zzz"];
NSDate *temp3 = [formatterTime4 dateFromString:@"2011-03-21 9:35 am GMT+8"];

[formatterTime setDateFormat:@"yyyy-MM-dd HH:mm:ss ZZ"];
NSDate *temp4 = [formatterTime dateFromString:@"2012-03-17 16:09:02 +0800"];
我对代码的错误感到非常困惑。有人有办法吗


***编辑

我曾经在一个特定的设备型号上遇到过类似的问题——或者说,我是这么想的,因为我排除了所有其他因素。最后,我完全重置了设备,当我重新安装所有设备时,它又开始工作了。可能值得一试。

我曾经在一个特定的设备型号上遇到过类似的问题,或者我是这么想的,因为我排除了所有其他因素。最后,我完全重置了设备,当我重新安装所有设备时,它又开始工作了。可能值得一试。

为什么要初始化formatterTimeX变量,而使用FormatterPayerTimex?对不起,我的错。我已经编辑了以上内容。它应该是FormatterTimeXmay您的设备的时间设置可能有问题吗?我认为设备上的设置没有问题。既然这个函数直截了当。为什么要初始化formatterTimeX变量,而使用FormatterPayerTimex?对不起,我的错。我已经编辑了以上内容。它应该是FormatterTimeXmay您的设备的时间设置可能有问题吗?我认为设备上的设置没有问题。因为这个函数是直截了当的。