Turns out, this is a bug in UICollectionView or even ARC. And it is easily reproducible. You can download Apple's sample code:
http://developer.apple.com/library/ios/samplecode/CollectionView-Simple/Introduction/Intro.html and modify it to return 0 items to the collection view. Then try to perform the following code: dispatch_block_t block = ^{ printf("finished"); }; UICollectionViewFlowLayout *layout = (UICollectionViewFlowLayout *)self.collectionView.collectionViewLayout; [self.collectionView performBatchUpdates:^{ layout.minimumInteritemSpacing = 20; } completion:^(BOOL finished) { block(); }]; It will crash since `finish` will be `nil`. But if you make data source to return non-zero item count to the collection view then everything will work good. Created a bug report with ID 14744561. Affects iOS 6.0 and above. You may refer to the Apple Dev Forums discussion thread: https://devforums.apple.com/thread/198531?tstart=0 Thanks! Vlad. 15 авг. 2013 г., в 9:25, Vlad Alekseev <ippo...@me.com> написал(а): > Hey, > > ARC should drive this for me. If it wouldn’t, then it wouldn’t work in case > if there are items in the collection view. > Tried to copy manually - no results. BTW, not only «finish», but also > «completion» gets NULLified at the last step. > > Vlad. > > 15 авг. 2013 г., в 9:22, Jens Alfke <j...@mooseyard.com> написал(а): > >> Sounds like you forgot to copy the block — if it’s being invoked after the >> calling function returns (as a completion handler would) it needs to be >> copied so it can survive the loss of its original stack frame. >> >> —Jens > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com