This is driving me crazy! I have a UICollectionViewController as shown below:
class PhrasesCompactCollectionViewController: UICollectionViewController
my problem was that I had my UICollectionViewDataSource object created as local variable. So if you initialize your dataSource object manually in code, make sure to store it as global variable.