I have one NSArray with names in string objects like this:@[@\"john\", @\"smith\", @\"alex\", @\"louis\"], and I have another array that contains
NSArray
@[@\"john\", @\"smith\", @\"alex\", @\"louis\"]
Try this way;
NSArray *mainArray=@[@"A",@"B",@"C",@"D"]; NSArray *myArray=@[@"C",@"x"]; BOOL result=YES; for(id object in myArray){ if (![mainArray containsObject:object]) { result=NO; break; } } NSLog(@"%d",result); //1 means contains, 0 means not contains