title: Checking if an array contains a certain object (iOS)
body: <p>I need to check if a certain array contains a certain object, and if it does, delete that object. If it hasn't got that object, the funciton is suposed to add it into the array. The problem is that the object is always added because the checking statement always return false.</p>
  
  <p>Here's my current function:</p>
  
  <pre><code>- (void) myFunction:(NSString *)parameter {
  
      if (![myMutableArray containsObject:parameter]) {
  
          [myMutableArray addObject:parameter];
          NSLog(@"%@ added", parameter);
  
      } else {
  
          [myMutableArray removeObject:parameter];
          NSLog(@"%@ deleted", parameter);
  
      }
  }
  </code></pre>