I have two array
, called array1
and array2
. I would like to remove every object from array1
that's value of the "nameId"
key can be find in both array. Actually I'm trying it in a for loop
, but it doesn't make sense. It doesn not crash, it just simply calls the log in the else statement
, that I don't understand why happens. Maybe somebody could show me the right solution.
NSMutableArray *newArray = [self.array1 mutableCopy];
for (PFObject * object in newArray) {
PFObject *placeholderObject = object;
for (PFObject *object2 in self.array2) {
if ([placeholderObject[@"nameId"] isEqualToString:object2[@"nameId"]]) {
[self.array1 removeObject:object];
NSLog (@"EXISTING OBJECT FOUND %@", object);
} else {
NSLog(@"UNIQUE OBJECT FOUND %@", idO[@"hirCime"]);
}
}
}