Group Group Group Group Group Group Group Group Group

raywenderlich.com Forums

Video Tutorial: Intermediate Core Data Part 4: Fetched Results Controllers

Learn about fetched results controllers which make it easy to manage your fetch requests and predicates to link Core Data with a table view.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3815-intermediate-core-data/lessons/5

Many Thanks for such an amazing tutorial !

However, I ve faced a kind of challenge and I am looking for explanation and help

I am using NSFetchedResultsController to fetch data and show it in table view. The problem is the app crashes when I tried to delete any row, with this error message -> " *** Terminating app due to uncaught exception ‘NSRangeException’, reason: ‘*** -[_PFArray objectAtIndex:]: index (4) beyond bounds (4)’"


However, I can delete any row successfully only when I nil the “sectionNameKeyPath”

fetchedResultsController = NSFetchedResultsController(
fetchRequest: fetchRequest,
managedObjectContext: coreDataStack.managedObjectContext,
sectionNameKeyPath:nil, cacheName: nil)

My question is How I solve this problem without nil the sectionNameKeyPath ?

Thanks

Hi gregheo,
Thanks for your video that help me understand FetchedResultController in the app, but for now, the fetchedResultController always fetched ALL objects in sqlite database although I already set fetch batch size on NSFetchRequest. Can u help?

Hi, everyone!
Does anyone managed to get the Core Data Instruments work? All I found is:

This is a known issue with macOS 10.12. You should be able to launch your app in the simulator yourself and then attach to it with Instruments. Unfortunately, using Instruments to do the launching doesn’t work right now for the Core Data instruments.

https://forums.developer.apple.com/thread/68020

I tried to “…launch your app in the simulator yourself and then attach to it with Instruments”, but nothing changed.

Hi!
no core data instrument for me too! the instrument launch the app but there’s no log inside !!!

@luke_parham Can you please help with this when you get a chance? Thank you - much appreciated! :]

@rastakong @pavoleg I can’t be sure but it is possible that your simulator version is outdated or something. I haven’t been able to reproduce this issue unfortunately.

Love your videos, always concise and learn a lot helpful. Feel like my skills jump to a higher level right away! Please publish more videos like this!