title: Compare two NSArrays
body: <p>How can I compare two NSArrays so that I can delete everything that isn't in both arrays.</p>
  
  <p>I tried it like this:</p>
  
  <pre><code>    NSArray *array1 = [NSArray arrayWithObjects:@"1",@"2",@"3",@"4", nil]; 
      NSArray *array2 = [NSArray arrayWithObjects:@"1",@"2",@"5",@"6", nil];
  
      NSMutableArray *myMutableArray = [NSMutableArray arrayWithArray:array1];
      NSMutableArray *myMutableArrayTwo = [myMutableArray copy];
      [myMutableArray removeObjectsInArray:array2];
  
      [array1 release];
      [array2 release];
  
      NSArray *array3 = [myMutableArray copy];
      [myMutableArrayTwo removeObjectsInArray:array3]; // Error here: "SIGABRT"
  
      NSLog(@"array3:%@",myMutableArrayTwo);
  </code></pre>
  
  <p>But it doesn't work because of the error. It sais: "-[__NSArrayI removeObjectsInArray:]: unrecognized selector sent to instance 0x4e51550"</p>
  
  <p>What did I do wrong? Or are there easier ways to solve my problem?
  Thanks for the help</p>