I am running this for loop which deletes an indexValue if a condition is met. I am comparing two NSDate
objects and for some reason it is not working. According to the log the NSDate
objects match exactly.
Please guide me here.
Code
for (int u=0 ; u<arraywithDateAddedKeyss.count ; u++)
{
NSLog(@"arraywithDateAddedKeyss: %@ == Array 5: %@",arraywithDateAddedKeyss[u],oldArray[5]);
if (arraywithDateAddedKeyss[u] == oldArray[5])
{
[arraywithDateAddedKeyss removeObjectAtIndex:u];
[userDefaults setObject:arraywithDateAddedKeyss forKey:@"arraywithReminderDateKeys"];
[userDefaults synchronize];
NSLog(@"Object Removed from array1");
}
}
NSLog data
arraywithDateAddedKeyss: 2014-02-01 09:01:20 +0000 == Array 5: 2014-02-01 09:01:20 +0000