I have no idea how many weeks I have wasted debugging issues that come down to this problem. I am pretty mad at myself for forgetting this, but oh boy, it’s not gonna happen anymore. Oh no.
Ok, so you have
NSFetchedResultsController driving either a collection view or table view. And when customer is looking at those views, you want the changes to animate in/out, as Apple has ask us to do since the days when iOS was called iPhone OS. To do that, you need to implement the four horsemen of
However - and this is the trick - you don’t need to do that when those views are not visible. You only need to call
reloadData on end of changes. However, I guarantee you that 95% of iOS devs leave those four methods as they are. And experience hair-pulling mind-cracking
EXC_BAD_ACCESS crashes all over the place, in darn background threads that cause
postNotification:..:... and what not. And you have questions about this on StackOverflow being answered with
oh, just set
nilin viewWillDisappear and problem goes away. Re-set it on viewWillAppear
You don’t say! Well, it sure goes away, but you also lose all the changes and your views do not reflect the current state of data source. And then when you try to animate, more crashes ensue…
oh, that’s easy to fix. Just add
No. Do not do any of that crap.