I tried to delete a cell from collection view on didSelect method. But I had get a crash:[self.collectionView performBatchUpdates:^{ [self.movies removeObjectAtIndex:0]; NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; [self.collectionView deleteItemsAtIndexPaths:@[indexPath]]; } completion:^(BOOL finished) { NSLog(@"finished"); }];
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
I tried to delete a cell from collection view on didSelect method. But I had get a crash:
[self.collectionView performBatchUpdates:^{ [self.movies removeObjectAtIndex:0]; NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; [self.collectionView deleteItemsAtIndexPaths:@[indexPath]]; } completion:^(BOOL finished) { NSLog(@"finished"); }];
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'