iOS 10 bug: UICollectionView received layout attributes for a cell with an index path that does not exist : <p>Running my app in a device with iOS 10 I get this error:</p>

<p><em>UICollectionView received layout attributes for a cell with an index path that does not exist</em></p>

<p>In iOS 8 and 9 works fine. I have been researching and I have found that is something related to invalidate the collection view layout. I tried to implement that solution with no success, so I would like to ask for direct help. This is my hierarchy view:</p>

<pre><code>-&gt;Table view 
    -&gt;Each cell of table is a custom collection view [GitHub Repo][1]
        -&gt;Each item of collection view has another collection view
</code></pre>

<p>What I have tried is to insert</p>

<pre><code>    [self.collectionView.collectionViewLayout invalidateLayout];
</code></pre>

<p>In the</p>

<pre><code>- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
</code></pre>

<p>of both collection views. </p>

<p>Also I have tried to invalidate layout before doing a reload data, does not work...</p>

<p>Could anyone give me some directions to take?</p>
