title: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Duplicate states in queue'
body: <p>I'm working on a project that use <code>UISlideViewController</code>. I know that this may be a duplicate question but non of the posts before about this topic helped me. I have a specific problem, as I managed to understand. My app crashes on this block. I have read before, it's important to put all work with the UI in the main thread. This is the code:</p>
  
  <pre><code>pageViewController.setViewControllers([viewController],
                      direction: direction,
                      animated: animated,
                      completion: { completed in
                          dispatch_async(dispatch_get_main_queue()) {
   ...
  </code></pre>
  
  <p>The error that I get is next:</p>
  
  <pre><code>*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Duplicate states in queue'
  *** First throw call stack:
  (0x183fd1900 0x18363ff80 0x183fd17d0 0x18494499c 0x1894dc9f4 0x1894dcdec...)
  </code></pre>
  
  <p>Testing it further I also get this error on the same line of code:</p>
  
  <pre><code>    *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'No view controller managing visible view &lt;UITableView: 0x12744aa00;
  frame = (0 0; 375 515);
      clipsToBounds = YES; autoresize = W+H; 
      gestureRecognizers = &lt;NSArray: 0x12836cf60&gt;; 
      layer = &lt;CALayer: 0x1286226b0&gt;;
      contentOffset: {0, 0}; contentSize: {375, 291}&gt;'
  </code></pre>
  
  <p>The bug is very hard to reproduce. One literally needs to touch and scroll multiple times on UIPageViewController to get this crash.<br>
  Thanks for your time and help.</p>