title: AVQueuePlayer removeAllItems Crash
body: <p>I have problem with removeAllItems on AVQueuePlayer.</p>
  
  <p>I using AVQueuePlayer for playing music from the web. For playing next song, in this class we have method advanceToNextItem. But for previous we should create new queue. </p>
  
  <p>Why that I do it so:</p>
  
  <pre><code>- (void) initPlayer{
      ...
      playlist = [NSMutableArray array];
      playlistItems = [NSMutableArray array];
      ...
      player = [AVQueuePlayer queuePlayerWithItems:nil];
      player.actionAtItemEnd = AVPlayerActionAtItemEndAdvance;
      ...
  }
  
  - (void) play{
      if ([player.items count] &lt;= 0){
          [self playAtIndex:0];   //first run fires here
      } 
      [player play];
  }
  
  - (void)playAtIndex:(int)index
  {
      [player removeAllItems]; // &lt;------at first run it work correctly
      for (int i = index; i &lt;playlistItems.count; i ++) {
          AVPlayerItem* obj = [playlistItems objectAtIndex:i];
          if ([player canInsertItem:obj afterItem:nil]) {
              [obj seekToTime:kCMTimeZero];
              [player insertItem:obj afterItem:nil];
          }
      }
  }
  
  - (void) addTracks:(NSArray *)tracks{
      [playlist addObjectsFromArray:tracks];
  
      for (Track *track in tracks){
          AVPlayerItem *item = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:track.trackURL]];
          ...
          [playlistItems addObject:item];
      }
  }
  </code></pre>
  
  <p>Then I work with player:</p>
  
  <pre><code>[player initPlayer];
  [player addTracks:tracksList];
  [player play]; // all works fine, play next, pause and so on
  ...
  </code></pre>
  
  <p>somewhere I go to prev track and call playAtIndex:x, where first calls [player removeAllItems] and programm crashes on it.</p>
  
  <p>And Xcode returns me:</p>
  
  <blockquote>
    <p>*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 2147483647 beyond bounds [0 .. 153]'</p>
  </blockquote>
  
  <p>I tried to call just [player removeAllItems] and it crashes.</p>
  
  <p>Where could be problem? </p>