1

For some reason, my app just started doing this after months of not doing so. This popped up after a seemingly-unrelated use of OperationQueue (I always use main, so it's done on Thread 1).

Six attempts to call the same collectionView.makeItem function, the fourth failing with reason: EXC_BAD_ACCESS

As you can see, I call the exact same function 6 times in a row, and only on the 4th time does it fail. I see no pattern...

Ky -
  • 30,724
  • 51
  • 192
  • 308
  • I'm sure more code might help, but I've no idea what else to post. Let me know what more you need to know and I'll do what I can. – Ky - Jan 13 '17 at 16:38

1 Answers1

0

I haven't done very extensive digging or testing, but it seems a block like this was the culprit:

collectionView.performBatchUpdates({
    collectionView.reloadItems()
}, completionHandler: { [weak self] _ in
    // cleanup
})

Seems the collection view doesn't like doing much more than insert+remove inside the batch update context. Changing it to this seems to have cured the crash:

collectionView.reloadItems()
// cleanup
Ky -
  • 30,724
  • 51
  • 192
  • 308