title: Using containsObject with object arrays from different files
body: <p>So I have a class called ArtPiece that defines several attributes of public artpieces such as title, description, etc.  I store ArtPiece objects in an array called mapAnnotations in the appDelegate so they will be global, and they will be put on a map as annotations. When the map region changes I make a URL call to get the information of artpieces that entered the region, make artPiece objects from the parsed info, then add them to an array called items in a class called "ArtsXMLParser". I want mapAnnotations to hold all the artpieces that are on the map, but when the region changes I want to add only the artpieces from "items" that are not already in mapAnnotations, so as to not put duplicate annotations on the map. Here is a method in a third class that manages the annotations. Everything seems to work, but the if statement with containsObject: gets called everytime, so apparently the artpieces are never matching although when they are logged they have the same info. Is there a better way to see if two arrays have an object with the exact same attributes in common?</p>
  
  <pre><code>-(void)requestFinished:(ASIHTTPRequest *)request{
      //NSLog(@"requestFinished:");
  
      //NSLog(@"%@", [request responseString]);
      mainDelegate = (PublicArtAppDelegate*)[[UIApplication sharedApplication]delegate];      
      ArtsXMLParser *parser = [[ArtsXMLParser alloc] init];
      [parser parseXMLWithData:[request responseData] parseError:nil];
      newAnnots = [[NSMutableArray alloc] init];
  
      for (int xy = 0; xy&lt;[parser items].count; xy++) 
      {
          if (![mainDelegate.mapAnnotations containsObject:[[parser items]objectAtIndex:xy]])
          {
              NSLog(@"%@", [[parser items]objectAtIndex:xy]);
              [self.newAnnots addObject:[[parser items]objectAtIndex:xy]];            
              NSLog(@"%@", [newAnnots objectAtIndex:xy]);
              [mainDelegate.mapAnnotations addObject:[[parser items]objectAtIndex:xy]];
              NSLog(@"%@", [mainDelegate.mapAnnotations objectAtIndex:xy]);
          }
      }
      //mainDelegate.mapAnnotations = [parser items];
      [parser release];
  
      [self.mapView addAnnotations:self.newAnnots];
      [newAnnots removeAllObjects];
      //[mainDelegate.mapAnnotations addObject:newAnnots];
      [newAnnots release];
      if (mainDelegate.mapAnnotations==0) {
          UIAlertView *alert2 = [[UIAlertView alloc] initWithTitle:nil message:@"No art work match your search term" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
          [alert2 show];
          [alert2 release];
      }
  }
  </code></pre>
  
  <p>I'll be happy to clarify anything that wasn't explained well. Thanks for any help!</p>