Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

performBatchUpdates bug #26

Closed
scottphc opened this issue Jul 11, 2017 · 5 comments
Closed

performBatchUpdates bug #26

scottphc opened this issue Jul 11, 2017 · 5 comments

Comments

@scottphc
Copy link

scottphc commented Jul 11, 2017

Random crashes may happen because this issue:
https://openradar.appspot.com/28167779

I use DTCollectionViewManager with Realm, it threw this error:

Fatal Exception: RLMException
Index 6 is out of bounds (must be less than 0)
@DenTelezhkin
Copy link
Owner

I'm not convinced that those two issues are connected. That error message from Realm is very cryptic, index less than zero? Looks like this might be Realm bug as well.

Did you try looking into related issues on realm-cocoa repo?

realm/realm-swift#4248
realm/realm-swift#4499

@scottphc
Copy link
Author

scottphc commented Jul 12, 2017

I confirmed this is not a realm issue. I use reloadData instead of performBatchUpdates, and then everything will be fine.

The error is from

CollectionViewUpdater.swift > func storageDidPerformUpdate > collectionView?.performBatchUpdates

and it will tigger

collectionView:cellForItemAt
storage.item(at: indexPath)
RealmStorage.swift > func item > (sections[indexPath.section] as? ItemAtIndexPathRetrievable)?.itemAt(indexPath)
RealmSection.swift > func itemAt > results[indexPath.item]

then crash happened.

@DenTelezhkin
Copy link
Owner

Did you manage to dig out the reason why this is happening? Any suggestions on how to reproduce/fix this?

@scottphc
Copy link
Author

This is a UICollectionView bug, and the reproduced way you can see the link I provided.

I don't have any easily ways to fix this. Perhaps have some workarounds to skip Apple's bug, but need more testing.

Now I use reloadData instead of performBatchUpdates, but it will lose insert/update/delete animation.

@DenTelezhkin DenTelezhkin self-assigned this Jul 12, 2017
@DenTelezhkin
Copy link
Owner

I created a separate issue to track for this bug, since it is not connected to Realm and is more generic - #27.

I will close this issue for now. If you have any Realm-related workarounds/information for this issue, please reopen this issue. If you have ideas how to solve more generic problem, please post them in #27.

Thanks!

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

No branches or pull requests

2 participants