I receive data for an object person in sets of 5. Let's say name,age,gender,email,number. I did following to add the strings to NSobject:
DataObject *data=[DataObject new];
data.name=@"name";
data.age=@"age";
data.email=@"email";
//here i want to check for duplicates
[personArray addObject:data];
However, I want to check if the personArray is having the duplicate NSObjects or not.
I tried this,but it didnt work:
if(![personArray containsObject:data]){
      //add data
}
Edit: Actually, this is what I am trying to do:
I am getting the JSON repsonse and I am adding the properties into array. Before I used to get only one property,in that case, I did the following to eliminate the duplicates:
[JSON[@"person"] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
       if (![obj[@"email"] isEqual:[NSNull null]] && ![personArray containsObject:obj[@"email"]]  ) {
               [personArray addObject:obj[@"email"]];
        }
    }];
Later I got 5 properties for person, so I thought instead of adding them all to the array, I used NSObject class to tie the properties together and add one person to the array.
[JSON[@"person"] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
           if (![obj[@"email"] isEqual:[NSNull null]] && ![personArray containsObject:obj[@"email"]]  ) { //how to check for the duplicates here? 
                 DataObject *data=[DataObject new];
                 data.name=@"name";
                 data.age=@"age";
                 data.email=@"email";
                [personArray addObject:data];
            }
        }];
 
     
    