From df3a6538dc8be1756e9774336248d72f48f9d759 Mon Sep 17 00:00:00 2001 From: IPv6 Date: Thu, 21 Apr 2016 16:27:20 +0300 Subject: [PATCH 1/5] iPadAir photolibrary issues --- QBImagePicker/QBAlbumsViewController.m | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/QBImagePicker/QBAlbumsViewController.m b/QBImagePicker/QBAlbumsViewController.m index a08dfe28..860ce187 100644 --- a/QBImagePicker/QBAlbumsViewController.m +++ b/QBImagePicker/QBAlbumsViewController.m @@ -307,6 +307,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N contentMode:PHImageContentModeAspectFill options:nil resultHandler:^(UIImage *result, NSDictionary *info) { + if(!result){ + return; + } if (cell.tag == indexPath.row) { cell.imageView3.image = result; } @@ -323,6 +326,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N contentMode:PHImageContentModeAspectFill options:nil resultHandler:^(UIImage *result, NSDictionary *info) { + if(!result){ + return; + } if (cell.tag == indexPath.row) { cell.imageView2.image = result; } @@ -337,6 +343,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N contentMode:PHImageContentModeAspectFill options:nil resultHandler:^(UIImage *result, NSDictionary *info) { + if(!result){ + return; + } if (cell.tag == indexPath.row) { cell.imageView1.image = result; } From b3e02e2d4197d9131a700e5a712204e80f832cc6 Mon Sep 17 00:00:00 2001 From: IPv6 Date: Mon, 25 Apr 2016 13:29:29 +0300 Subject: [PATCH 2/5] iPadAir issues fix --- QBImagePicker/QBAssetsViewController.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/QBImagePicker/QBAssetsViewController.m b/QBImagePicker/QBAssetsViewController.m index 37381715..388f6851 100644 --- a/QBImagePicker/QBAssetsViewController.m +++ b/QBImagePicker/QBAssetsViewController.m @@ -454,6 +454,9 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell contentMode:PHImageContentModeAspectFill options:nil resultHandler:^(UIImage *result, NSDictionary *info) { + if(!result){ + return; + } if (cell.tag == indexPath.item) { cell.imageView.image = result; } From ca7400f58a355041cb68c24fedcf5997f41cfd51 Mon Sep 17 00:00:00 2001 From: IPv6 Date: Wed, 27 Jul 2016 17:52:30 +0300 Subject: [PATCH 3/5] Crash fix --- QBImagePicker/QBAssetsViewController.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/QBImagePicker/QBAssetsViewController.m b/QBImagePicker/QBAssetsViewController.m index 388f6851..eab86469 100644 --- a/QBImagePicker/QBAssetsViewController.m +++ b/QBImagePicker/QBAssetsViewController.m @@ -405,7 +405,9 @@ - (void)photoLibraryDidChange:(PHChange *)changeInstance [self.collectionView insertItemsAtIndexPaths:[insertedIndexes qb_indexPathsFromIndexesWithSection:0]]; } - NSIndexSet *changedIndexes = [collectionChanges changedIndexes]; + NSMutableIndexSet *changedIndexes = [collectionChanges changedIndexes].mutableCopy; + // due https://rink.hockeyapp.net/manage/apps/45585/app_versions/44/crash_reasons/130056083 + [changedIndexes removeIndexes:removedIndexes]; if ([changedIndexes count]) { [self.collectionView reloadItemsAtIndexPaths:[changedIndexes qb_indexPathsFromIndexesWithSection:0]]; } From 93bdf129f2ad7dd4c3a62b2530d8bdc8b3782479 Mon Sep 17 00:00:00 2001 From: IPv6 Date: Mon, 24 Oct 2016 14:52:59 +0300 Subject: [PATCH 4/5] crash fix --- QBImagePicker/QBAssetsViewController.m | 53 +++++++++++++------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/QBImagePicker/QBAssetsViewController.m b/QBImagePicker/QBAssetsViewController.m index eab86469..13e74d55 100644 --- a/QBImagePicker/QBAssetsViewController.m +++ b/QBImagePicker/QBAssetsViewController.m @@ -388,32 +388,33 @@ - (void)photoLibraryDidChange:(PHChange *)changeInstance if (collectionChanges) { // Get the new fetch result self.fetchResult = [collectionChanges fetchResultAfterChanges]; - - if (![collectionChanges hasIncrementalChanges] || [collectionChanges hasMoves]) { - // We need to reload all if the incremental diffs are not available - [self.collectionView reloadData]; - } else { - // If we have incremental diffs, tell the collection view to animate insertions and deletions - [self.collectionView performBatchUpdates:^{ - NSIndexSet *removedIndexes = [collectionChanges removedIndexes]; - if ([removedIndexes count]) { - [self.collectionView deleteItemsAtIndexPaths:[removedIndexes qb_indexPathsFromIndexesWithSection:0]]; - } - - NSIndexSet *insertedIndexes = [collectionChanges insertedIndexes]; - if ([insertedIndexes count]) { - [self.collectionView insertItemsAtIndexPaths:[insertedIndexes qb_indexPathsFromIndexesWithSection:0]]; - } - - NSMutableIndexSet *changedIndexes = [collectionChanges changedIndexes].mutableCopy; - // due https://rink.hockeyapp.net/manage/apps/45585/app_versions/44/crash_reasons/130056083 - [changedIndexes removeIndexes:removedIndexes]; - if ([changedIndexes count]) { - [self.collectionView reloadItemsAtIndexPaths:[changedIndexes qb_indexPathsFromIndexesWithSection:0]]; - } - } completion:NULL]; - } - + [self.collectionView reloadData]; + // Frequent random crashes on proper animation + // https://rink.hockeyapp.net/manage/apps/45585/app_versions/42/crash_reasons/123652251 +// if (![collectionChanges hasIncrementalChanges] || [collectionChanges hasMoves]) { +// // We need to reload all if the incremental diffs are not available +// [self.collectionView reloadData]; +// } else { +// // If we have incremental diffs, tell the collection view to animate insertions and deletions +// [self.collectionView performBatchUpdates:^{ +// NSIndexSet *removedIndexes = [collectionChanges removedIndexes]; +// if ([removedIndexes count]) { +// [self.collectionView deleteItemsAtIndexPaths:[removedIndexes qb_indexPathsFromIndexesWithSection:0]]; +// } +// +// NSIndexSet *insertedIndexes = [collectionChanges insertedIndexes]; +// if ([insertedIndexes count]) { +// [self.collectionView insertItemsAtIndexPaths:[insertedIndexes qb_indexPathsFromIndexesWithSection:0]]; +// } +// +// NSMutableIndexSet *changedIndexes = [collectionChanges changedIndexes].mutableCopy; +// // due https://rink.hockeyapp.net/manage/apps/45585/app_versions/44/crash_reasons/130056083 +// [changedIndexes removeIndexes:removedIndexes]; +// if ([changedIndexes count]) { +// [self.collectionView reloadItemsAtIndexPaths:[changedIndexes qb_indexPathsFromIndexesWithSection:0]]; +// } +// } completion:NULL]; +// } [self resetCachedAssets]; } }); From 169ad4af456e10e4ee73b26a82a202420c22eee3 Mon Sep 17 00:00:00 2001 From: IPv6 Date: Tue, 27 Dec 2016 18:48:22 +0300 Subject: [PATCH 5/5] posible crashfix --- QBImagePicker/QBAssetsViewController.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/QBImagePicker/QBAssetsViewController.m b/QBImagePicker/QBAssetsViewController.m index 13e74d55..c8c1669a 100644 --- a/QBImagePicker/QBAssetsViewController.m +++ b/QBImagePicker/QBAssetsViewController.m @@ -658,8 +658,7 @@ - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollection numberOfColumns = self.imagePickerController.numberOfColumnsInLandscape; } - CGFloat width = (CGRectGetWidth(self.view.frame) - 2.0 * (numberOfColumns - 1)) / numberOfColumns; - + CGFloat width = MAX(1,(CGRectGetWidth(self.view.frame) - 2.0 * (numberOfColumns - 1)) / numberOfColumns); return CGSizeMake(width, width); }