locked
iOS 7 crash in collectionview RRS feed

  • Question

  • User13457 posted

    Hello all

    I recently updated to the new iOS 7 build tools and started getting crashes in my app only in iOS 7 in the collectionview controller that works fine in iOS6. I only get the following message show up before the app dies in the simulator. I have not tried it on the device yet.

    *** Assertion failure in -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:],   /SourceCache/UIKit_Sim/UIKit-2903.2/UICollectionView.m:1367
    

    Has anyone seen anything like this? The same code runs fine on iOS 6 in the simulator.

    My collectionview has it's cell defined in a xib. I use Nib.Instantiate() to create the cells and add them via the datasource.

    Thanks

    Monday, September 23, 2013 6:55 PM

All replies

  • User13457 posted

    I figured it out. I had incorrectly used CollectionView.RegisterClassForCell. Apparently I was supposed to use CollectionView.RegisterNibForCell when setting up the viewcontroller. That fixed the problem. iOS 6 must have been more forgiving.

    Monday, September 23, 2013 8:34 PM
  • User113284 posted

    Thanks for the help.

    In my case I was trying to Instantiate the nib of the row in the GetCell method like in the UITableView but it's not the correct way for the UICollectionView.

    I need to RegisterNibForCell as you told and use DequeueReusableCell in the GetCell using the same identifier.

    Monday, February 8, 2016 10:11 AM