Note that there are some explanatory texts on larger screens.

plurals
  1. POUICollectionView insertSections error - NSInvalidArgumentException reason setObjectForKey object cannot be nil UICollectionViewItemKey
    primarykey
    data
    text
    <p>I'm getting an error using a UICollectionView as follows:</p> <pre><code>2013-11-29 17:29:07.832 Clients[34200:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: &lt;_UICollectionViewItemKey: 0x8da14f0&gt; Type = DV ReuseID = (null) IndexPath = (null))' </code></pre> <p>And the code is as follows, where I essentially have two NSMutableArrays -- one containing all entries and the other used to reduce the entries to one section -- in this bit, I'm adding all the missing sections back in (hope that makes sense).</p> <pre><code>[self.collectionView performBatchUpdates:^{ NSString *selectedMarketSector = [[[[_marketSectors objectAtIndex:0] clients] objectAtIndex:0] clientMarketSector]; NSMutableIndexSet *insertSections = [[NSMutableIndexSet alloc] init]; for (TBMarketSector* sector in _allMarketSectors) { if (![[[[sector clients] objectAtIndex:0] clientMarketSector ] isEqualToString:selectedMarketSector]) { [insertSections addIndex:[_allMarketSectors indexOfObject:sector]]; } } _marketSectors = [self.allMarketSectors mutableCopy]; [self.collectionView insertSections:insertSections]; } completion:^(BOOL finished) { [self setLayoutStyle:TBLayoutStacks animated:YES]; }]; </code></pre> <p>The line that 'appears' to be causing the problem is the <code>[self.collectionView insertSections:insertSections];</code> but I'm wondering if there is something weird going on elsewhere...</p> <p>Thanks for any assistance you can provide.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload