是的,贊同@Jan Gressmann,這是如此的奇怪!我現在用的是NSDateFormatter非UI線程,以及,dateFromString選擇回報有時空...例如,我有這樣的代碼:
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
NSLocale *usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
[dateFormat setLocale:usLocale];
[dateFormat setDateFormat:@"dd MMM yy HH:mm:ss"];
NSDate *startDate = [dateFormat dateFromString:str_StartDate];
NSDate *endDate = [dateFormat dateFromString:str_endDate];
輸出控制檯:
(lldb) po str_StartDate
(NSString *) $7 = 0x06da2180 03 SEP 2012 10:00:00
(lldb) po str_endDate
(NSString *) $8 = 0x06d3a810 08 SEP 2013 10:00:00
(lldb) po startDate
(NSDate *) $9 = 0x00000000 <nil>
(lldb) po endDate
(NSDate *) $10 = 0x06db05b0 2013-09-08 02:00:00 +0000
這真是奇怪...
看起來像昨天你問的同樣的問題,但簡化了。你應該修改原來的問題。我們有些人花了很多時間來幫助你。 http://stackoverflow.com/questions/5628062/memory-management-and-global-variable/5628202#5628202 – XJones 2011-04-12 16:25:31