我有一个看起来像这样的类方法:
+ (NSTimeInterval)calculateTimeDifferenceBetweenEventDate:(NSDate *)eventTime andEventTime:(NSDate *)eventDate {
NSTimeInterval timeDifference = [eventTime timeIntervalSinceDate:eventDate];
// If eventTime is earlier than eventDate, a negative number is returned
// If eventTime is later than eventDate, a positive number is returned
return timeDifference;
}
我使用这样的方法:
NSTimeInterval timeDifference = [Utilities calculateTimeDifferenceBetweenEventDate:reminder.date andEventTime:savedEventDate];
但由于某些原因,每次我使用这个类方法时返回的值都是0.当我在里面并调试方法时,我看到timeDifference
实际上包含一个合法的数字。但由于某种原因它不会被正确归还?