Page 187 of the iOS Apprentice Tutorial 3 (pdf version) says:
Speaking of nasty bugs, iOS 10.0 introduces one that’s a doozy. Parts of Core Data were rewritten for Swift 3.0 and I’m afraid some new bugs slipped into the code.
…
Because NSFetchedResultsController sends the wrong message, the app gets confused and crashes. Yikes! This bug is pretty serious. Until this is fixed, I cannot recommend you use NSFetchedResultsController in your own apps if you’re using multiple sections.
Is this still true in iOS 10? Or has this been fixed? I couldn’t seem to replicate the issue in Xcode. I’ve spent so many hours trying to fix bugs, that it’s strange trying to purposefully make one…
It may have been fixed in 10.1 or so but it definitely was still present in 10.0. I haven’t checked yet myself.
3 things I discovered about this today:
-
It seems this may have been mentioned too early in the book, as if it relates to the preceding content on pg 185. This error only appeared for me after trying to organize the list into multiple sections, which doesn’t happen until pg 189. The text mentions multiple sections as well, so maybe it was meant to follow later?
-
Apparently issues with mixed-up calls to NSFetchedResultsControllerDelegate .move vs .update methods have been an ongoing issue since iOS9. Fixed in iOS10.2 according to this post:
Wrong delegate called for NSFetche… | Apple Developer Forums
-
I did get this exact error at first, then tried some of the fixes suggested in that post. The underlying problem turned out to be that I had entirely forgotten to add the numberOfSections
TableViewDataSource method :\ Once I added that the errors went away. Works fine now on iPhone 5S running iOS 10.0.2.