I'm getting the error ...
*** Assertion failure in -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:], /SourceCache/UIKit/UIKit-2372/UICollectionView.m:2249
When trying to display a UICollectionView.
The lines causing it are...
static NSString *CellIdentifier = @"Cell";
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
Error happening on the dequeue.
There are no other errors so I'm struggling to know where to begin with this.
Can anyone shed light on this?
I have seen this error pop up when using multiple UICollectionViews with unique ReuseIdentifiers. In ViewDidLoad you want to register each CollectionView's reuseIdentifier like so:
Then when you get to "- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath" you want to make sure that you don't try to set a cell for collectionView1 to the reuseIdentifier for collectionView2 or you will get this error.
DON'T DO THIS: (Or collectionView2 will see the wrong Identifier and throw a fit before seeing the identifier it was expecting)
DO THIS: