Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8339043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:46:29+00:00 2026-06-09T04:46:29+00:00

After reading lots of documentation and examples of Core Data framework, I still don’t

  • 0

After reading lots of documentation and examples of Core Data framework, I still don’t quite get it. What happens is that I sort of understand parts of a sample code or documentation, but often can’t fit it into a larger picture. The second time I read the same code, I still need lots of time to figure it out just like the first time. It’s so frustrating.

The NSFetchedResultsControllerDelegate vs NSFetchedResultsController is one of those concepts in Core Data that confuse me.

I think what I need is a simple and conceptual explanation, maybe analogy will be helpful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:46:31+00:00Added an answer on June 9, 2026 at 4:46 am

    All your core data objects have to be accessed via managed object context.

    Think of NSFetchRequest as a representation of the database query. When you tell the NSManagedObjectContext (MOC) to fetch data, you give it a fetch request, so it knows what to fetch.

    Now, let’s say you have a table view. You make a fetch, and have all the data, even for the stuff you don’t need to display. Each time the table view changes, and you need to refetch the data. There are a few other issues with just using a fetch request, though it can be done.

    To solve some of these problems, enter NSFetchedResultsController (FRC). It manages the database so that you only have the objects in memory that are actually needed at the time. Furthermore, it hooks into the MOC so that when the database changes, it automatically changes its own data.

    So, you create a FRC and give it a fetch request. Now, it manages the data so it only has in memory what you want. But, you need to tell it what to grab, and it need to tell you when it has data.

    Thus is where the NSFetchedResultsControllerDelegate comes in.

    The delegate is the glue between the table view (or some other component) and the FRC. The delegate methods are the communication channel that informs the FRC what data to get, when to get it, then hand it off to the table view.

    EDIT

    Yes, FRC manages the actual data part. However, when its data changes, it has to have some way to notify the guy who is watching the data. That’s what the delegate is for. Let’s take a different attack by looking at the delegate methods.

    Imagine that the database has been changed in some way. The FRC, through its special magical incantations, has noticed the change, and, like a teenager with a new iPhone, needs to tell someone.

    Specifically, again, in your case, it needs to tell the table view that is responsible for displaying the data to the user. Well, how is it going to tell the table view that the data has changed? There are actually several patterns used in iOS, and in this case, we use a delegate.

    The guy who is interested in receiving this information from the FRC give him a pointer to an object that implements the delegate methods. When the FRC wants to notify the guy interested, it calls the appropriate methods on the object that is was given as the delegate.

    Consider a change has happened. The FRC code would look something like this (ultra-simplified but to give the algorithmic idea).

    [delegate controllerWillChangeContent:self];
    
    // Process all the changes...
    
    for (SectionChangeInfo *info in changedSections) {
        [delegate controller:self didChangeSection:info.sectionInfo atIndex:info.index forChangeType:info.changeType];
    }
    
    for (ObjectChangeInfo *info in changedObjects) {
        [delegate controller:self didChangeObject:info.object atIndexPath:info.indexPath forChangeType:info.changeType newIndexPath:index.newIndexPath];
    }
    
    [delegate controllerDidChangeContent:self];
    

    Thus, the FRC can tell “somebody” about changes when they occur. In your case, when you give the FRC a delegate, it will call those methods, thus giving you a chance to handle the changes when they happen.

    The other delegate method is called to ask the delegate what it wants to use as a section title. So, assume the FRC needs to know what to use, it will call…

    NSString *sectionTitle = [[section substringToIndex:1] uppercase];
    if ([delegate respondsToSelector:@selector(controller:sectionIndexTitleForSectionName:)]) {
        sectionTitle = [delegate controller:self sectionIndexTitleForSectionName:section];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After reading lots of blogs, forum entries and several Apple docs, I still don't
I'm still relatively new to CSS, but after lots of Stack Overflow reading, I
Im new to iphone development and after lots of reading on it im still
After reading monkeytalk faq from http://www.gorillalogic.com/testing-tools/monkeytalk/documentation/monkeytalk-faq : How does it all work? MonkeyTalk is
After reading MSDN-XAML Namespaces and MSDN-Understanding XAML Namespaces , I still do not understand
after reading the cookbook and various Q&A here I am still a bit confused
After reading jQuery's CSS documentation , it doesn't look like it offers any advantages
After reading several articles of a hierarchical data tables, I've made my way into
After reading on stackoverflow that in the case of checking the format of a
After reading lots of sample code into this matter, I'm trying to figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.