I'm trying to setup an UICollectionView. At first I was using the basic UICollectionViewCell, it was working well, the cells were being displayed.
Then I created my own collectionViewCell (subclassing UICollectionViewCell), to be able to display an image in the cell.
I linked the custom cell in the Storyboard with an identifier and I also specified the right class for it.
However, I keep having this error, and I don't understand why:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier MediaCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
I managed to take care of the bug by adding this line in the viewDidLoad but in the tutorials I was following the guys were not using it:
[self.collectionView registerClass:[MediaCollectionViewCell class] forCellWithReuseIdentifier:@"MediaCell"];
The problem is that if I add it, the collectionView remains black and no data is displayed.