I'm trying to get the time interval between two NSDates, namely previousActivity.stopTimeand previousActivity.startTime. I get an error with this code:
NSTimeInterval *previousActivityDuration = [previousActivity.stopTime timeIntervalSinceDate:previousActivity.startTime];
This is where the error message appears:
"Initializing 'NSTimeInterval *' (aka 'double *') with an expression of incompatible type 'NSTimeInterval' (aka 'double')"
I do not understand; If NSTimeInterval aka 'double', how is the initialization expression incompatible and how to fix it?
Many thanks!
Edit:
In @Rmaddy's comment, I removed the asterisk. Then I get this error in the line following:
Assigning to 'NSNumber *' from incompatible type 'NSTimeInterval' (aka 'double')
Here's an offensive line:
previousActivity.duration = previousActivityDuration;
source
share