I'm enumerating a dictionary and checking for a known date. If the exact date (both date and time) matches my known date, I want the for loop to stop enumerating. THe issue I'm having is that during the check, I break out of the if statement instead of the for loop.
//known date has already been applied to self.knownDate
for (id object in array) {
NSDate *objectDate = object.date;
if ([self.knownDate isEqualToDate:objectDate]) {
break;
}
NSLog(@"date didn't match, move on to next entry");
}
The problem is, the for loop keeps going, because only the IF statement is broken.
How can I refactor this so that the for loop quits?
By the way, I need to check both date & time from the NSDate object. The documentation says isEqualToDate checks sub-second differences, but it appears to be catching anything that is during the same day, not including time.