我的代码是这样的为什么我的NSDateFormatter在解析时返回nil?
NSString *tempDate = [NSString stringWithString:tempReviewData.pubDate];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateStyle:NSDateFormatterLongStyle];
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];
[dateFormatter setDateFormat:@"HH:mm a"];
NSDate *newDate = [dateFormatter dateFromString:tempReviewData.pubDate];
我newDate在这一点上我不知道为什么
您创建该'tempDate'变量和放入它的对象的任何特定原因?你以后不要使用任何一个;您使用从'pubDate'方法返回的原始日期。 –