My app is attempting to determine if todays date is in between an object in an array's start date and end date, and would then remove that object from the array. The code successfully removes objects from the array, but only every other object (where all of them should be removed).
for (int i = 0; i < [AdDataArray count]; i++) {
NSDate *dateStart = [self adStartDateAtIndex:i];
NSDate *dateEnd = [self adEndDateAtIndex:i];
if (([dateNow earlierDate:dateStart]) || ([dateNow laterDate:dateEnd]))
{
[AdDataArray removeObjectAtIndex:i];
}
i++;
}
If a second set of eyes could go over my code and see what I am doing wrong, that would be greatly appreciated!