所以我有一个任务实体类(核心数据),我试图覆盖它的一个字符串(timeIntervalString)的设置器,所以它可以显示在表格视图单元格的详细文本标签中。出于某种原因,我收到这样的 EXC_BAD_ACCESS 错误:
[Tasks timeIntervalString] 一直持续到 37355...
这是我的代码:
-(NSString *)timeIntervalString{
NSUInteger seconds = (NSUInteger)round(self.timeInterval);
if ((seconds/3600) == 0){
if (((seconds/60) % 60) == 1) {
self.timeIntervalString = [NSString stringWithFormat:@"%u MIN", ((seconds/60) % 60)];
} else {
self.timeIntervalString = [NSString stringWithFormat:@"%u MINS", ((seconds/60) % 60)];
}
} else if ([self.conversionInfo hour] == 1) {
if (((seconds/60) % 60) == 0){
self.timeIntervalString = [NSString stringWithFormat:@"%u HR", (seconds/3600)];
} else if (((seconds/60) % 60) == 1) {
self.timeIntervalString = [NSString stringWithFormat:@"%u HR %u MIN", (seconds/3600), ((seconds/60) % 60)];
} else {
self.timeIntervalString = [NSString stringWithFormat:@"%u HR %u MINS", (seconds/3600), ((seconds/60) % 60)];
}
} else {
if (((seconds/60) % 60) == 0) {
self.timeIntervalString = [NSString stringWithFormat:@"%u HRS ", (seconds/3600)];
} else if (((seconds/60) % 60) == 1){
self.timeIntervalString = [NSString stringWithFormat:@"%u HRS %u MIN", (seconds/3600), ((seconds/60) % 60)];
} else {
self.timeIntervalString = [NSString stringWithFormat:@"%u HRS %u MINS", (seconds/3600), ((seconds/60) % 60)];
}
}
return self.timeIntervalString;
}
有任何想法吗?