title: What does it mean UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:?
body: <p>Assertion failure in -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:]</p>
  
  <p>I got this error since IOS 7. It works fine in IOS 6.</p>
  
  <p>I look around the web and I found this:</p>
  
  <p><a href="http://forums.xamarin.com/discussion/8233/ios-7-crash-in-collectionview">http://forums.xamarin.com/discussion/8233/ios-7-crash-in-collectionview</a></p>
  
  <p>However, the solution doesn't make sense</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>Could any of you give me a hint on this bug</p>
  
  <p>Symptomps: </p>
  
  <ol>
  <li>Crash</li>
  <li>Assertion failure in -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:]</li>
  <li>Works in IOS6 and not IOS 7</li>
  </ol>
  
  <p>The code I am suspicious with is this:</p>
  
  <pre><code>- (CGSize)collectionView:(UICollectionView *)collectionView
                    layout:(UICollectionViewLayout*)collectionViewLayout
    sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
      CGSize sz = [BGCollectionViewCellImage defaultSize];
      return sz;
  }
  </code></pre>
  
  <p>But it seems to be too ordinary.</p>
  
  <p>sz is simply CGSize of 100*120</p>
  
  <p>Another is this:</p>
  
  <pre><code>- (BGCollectionViewCellImage *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
  {
      BGCollectionViewCellImage * cell = [[BGCollectionViewCellImage alloc]init];
      Image * img= self.arImages[indexPath.row];
      [cell setImg:img andIndex:indexPath.row+1];
  
      return cell;
  }
  </code></pre>
  
  <p>Maybe I should use dequeue something like in UITableViewCell</p>
  
  <p>I got another hint. If I tried to dequeue some cell, I got this:</p>
  
  <p>2013-10-14 21:18:34.346 domainname[24667:a0b] <strong>* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier BGCollectionViewCellImage - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
  *</strong> First throw call stack:
  (</p>
  
  <p>Looks like I got to register something first.</p>