iOS 15 build by xcode 13 crash on collectionView performBatchUpdates

264 views Asked by At

After updating xcode to xcode 13. My app start giving crash on the collectionview where it is using performBatchUpdates on ios 15.

It's working fine on lower ios version.

dispatch_async(dispatch_get_main_queue(), ^{
    [self.collectionView performBatchUpdates:^{
        [weakSelf.collectionView insertItemsAtIndexPaths:addedIndexPaths];
    } completion:^(BOOL finished) {
   

        // scroll to the last added asset, so the user can see the process of uploading.
        NSIndexPath *lastIndexPath = addedIndexPaths.lastObject;
        if (lastIndexPath) {
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                [weakSelf.collectionView scrollToItemAtIndexPath:lastIndexPath
                                                atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:YES];
            });
        }
    }];
});

Did anybody facing some issue and got some solution with this.

0

There are 0 answers