According to this article 我应该可以简单地+ =两个NSTimeIntervals一起......但我不能。 我试图处理在秒表上点击“暂停”,并能够通过使用“跑步计数器”来继续,以便说出名为totalDuration的NSTimeInterval。 但是,当我这样做iOS:为什么我不能将两个NSTimeIntervals一起添加?
NSDate *currentDate = [NSDate date];
NSTimeInterval timeInterval = [currentDate timeIntervalSinceDate:startDate];
// Add the saved interval
totalDuration += timeInterval;
我得到:
.../Views/bdNewTrackViewController.m:506:19: Invalid operands to binary expression ('NSTimeInterval *' (aka 'double *') and 'NSTimeInterval' (aka 'double'))
百思不得其解......
这里的累计数据类型是什么? –