Согласно Apple, документации NSDate сравнения:
Returns an NSComparisonResult value that indicates the temporal ordering of the receiver and another given date.
- (NSComparisonResult)compare:(NSDate *)anotherDate
параметров anotherDate
Дата, с которой для сравнения приемник. Это значение не должно быть nil.
Return Value
If:
The receiver and anotherDate are exactly equal to each other, NSOrderedSame
The receiver is later in time than anotherDate, NSOrderedDescending
The receiver is earlier in time than anotherDate, NSOrderedAscending
In other words:
if ([date1 compare:date2]==NSOrderedSame) ...
Note that it might be easier to read and write this :
if ([date2 isEqualToDate:date2]) ...
Текущее время с точностью до точки? Я сомневаюсь, что '[dateArray containsObject: [NSDate date]]' будет работать из коробки ... –
проверить это может быть, это дает вам некоторую идею. http://stackoverflow.com/questions/13229142/how-to-compare-current-date-to-previous-date-in-iphone/13229194#13229194 –
Вы пробовали метод сравнения NSDate? если он возвращает NSOrderedSame, даты совпадают. – Vertig0