我正在尝试将 NSString 转换为日期,添加一天,然后转换回字符串。
到目前为止,我的代码是这样的:
//convert curDate (from @property declaration) to NSDate
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"dd-MM-yyyy"];
NSDate *dateFromString = [[NSDate alloc] init];
dateFromString = [dateFormatter dateFromString:curDate];
//add a day
dateFromString = [dateFromString dateByAddingTimeInterval:60*60*24*1];
//convert back to string (for use in URL string concatenation)
NSString *dateDisplay = [dateFormatter stringFromDate:dateFromString];
//set curDate to new date
curDate = dateDisplay;
它在以下位置崩溃到堆栈:
0x117f09b: movl 8(%edx), %edi
(不确定这是否有用)。
谁能说这是为什么?
谢谢!