title: Remove object from NSArray by index
body: <p>I have a code that removes an object from an NSCollectionView, but it only removes one item. In the NSArray ("array") the value is "2 4" which returns 2, 4. But when I run the code, it only removes "2" and not "4".</p>
  
  <p><strong>The Log:</strong></p>
  
  <p><a href="http://i.stack.imgur.com/iAVf2.png" rel="nofollow">Click here for the image of the NSLOG.</a></p>
  
  <p><strong>The Code</strong></p>
  
  <pre><code>NSString* LibraryPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0];
  NSString *plistPathSMSettings = [LibraryPath stringByAppendingString:stormarManagerSettingsPlistPath];
  NSString *betasDef = [SMInAppCommunicationDEF stringByAppendingString:@"BETA App Id"];
  
  NSString *indexOfApp = [Functions readDataFromPlist:plistPathSMSettings ForKey:betasDef];
  
  if (!(indexOfApp == nil)) {
      NSArray * array = [indexOfApp componentsSeparatedByString:@" "];
      NSLog(@"Array: ", array);
      int currentValue = 0;
      for (int i = 0; i &lt; [array count]; i++)
      {
          currentValue = [(NSNumber *)[array objectAtIndex:i] intValue];
          NSLog(@"currentValue: %d", currentValue); // EXE_BAD_ACCESS
              NSLog(@"x: %d", i);
              [self.content removeObjectAtIndex:(currentValue)];
              [self.collectionView setContent:self.content];
              [self.collectionView reloadData];
              NSLog(@"next: %d", currentValue); // EXE_BAD_ACCESS
  
      }
  }
  else if (indexOfApp == nil) {
      [self.collectionView setContent:self.content];
      [self.collectionView reloadData];
  }
  </code></pre>