0

我有一个看起来像这样的类方法:

+ (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实际上包含一个合法的数字。但是由于某种原因它不会正确返回?

4

0 回答 0