Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

Crash in PhotoLibraryDidChange #171

Open
chrisga opened this issue Jul 20, 2016 · 4 comments · May be fixed by #180
Open

Crash in PhotoLibraryDidChange #171

chrisga opened this issue Jul 20, 2016 · 4 comments · May be fixed by #180

Comments

@chrisga
Copy link

chrisga commented Jul 20, 2016

Anybody else seeing a crashing problem?

The error is: uncaught ObjC exception, reason: attempt to delete and reload the same index path (<NSIndexPath: 0xc000000067e00016> {length = 2, path = 0 - 831})

Seems to happen when a person makes a change to a photolibrary.
I believe it crashes in the block self.collectionView performBatchUpdates

Thanks,
Chris

@haisergeant
Copy link

Is there anyway to work around of this issue? Since I see many of users who downloaded my app saw this crash issue.

@haisergeant
Copy link

The problem when user made changes in their photo library (for example share photos with others, or change photos on iCloud/synced with iTunes). Any work around or approach to solve this problem is a great help.

@chrisga
Copy link
Author

chrisga commented Jul 29, 2016

Here is a fix for the problem.
I'll push it up when I get a chance.
This is near the end of photoLibraryDidChange

Replace:
[self.collectionView reloadItemsAtIndexPaths:[changedIndexes qb_indexPathsFromIndexesWithSection:0]];

with:
NSMutableIndexSet *changedWithoutRemovalsIndexes = [changedIndexes mutableCopy];
[changedWithoutRemovalsIndexes removeIndexes:removedIndexes];
[self.collectionView reloadItemsAtIndexPaths:[changedWithoutRemovalsIndexes

It will then be:
if ([changedIndexes count]) {
NSMutableIndexSet *changedWithoutRemovalsIndexes = [changedIndexes mutableCopy];
[changedWithoutRemovalsIndexes removeIndexes:removedIndexes];
[self.collectionView reloadItemsAtIndexPaths:[changedWithoutRemovalsIndexes qb_indexPathsFromIndexesWithSection:0]];
}

Chris

@chrisga chrisga closed this as completed Jul 29, 2016
@chrisga chrisga linked a pull request Oct 1, 2016 that will close this issue
@chrisga
Copy link
Author

chrisga commented Oct 1, 2016

I created a pull request with the fix. Reopening the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants