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 8332263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:40:19+00:00 2026-06-09T02:40:19+00:00

I noticed there are two different fetch requests in one complete Core Data process.

  • 0

I noticed there are two different fetch requests in one complete Core Data process.

Fetch request A:
a Context (MOC) instance fetches data from disk to memory by creating a fetch request and executing it (executeFetchRequest).

Fetch request B:
a FRC instance is init with another fetch request, fetching data from memory ( specify a context) to memory, which happens automatically so no need to “execute” this fetch.

Connection between Fetch request A and Fetch request B

1.A and B’s contexts must be the same one

2.The result of fetch B is a subset of result of fetch A

Question
I want to know if my understanding is absolutely correct. Please point out any inaccurate statement and misconception. Thanks.

Sample code

Fetch A (executed explicitly): from disk to memory

NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@"Photo"];   

request.predicate = [NSPredicate predicateWithFormat:@"unique = %@", [flickrInfo 
objectForKey:FLICKR_PHOTO_ID]]; 

NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"title" ascending:YES]; 

request.sortDescriptors = [NSArray arrayWithObject:sortDescriptor];

NSError *error = nil;

// execute the fetch    
NSArray *matches = [context executeFetchRequest:request error:&error];  

Fetch B (automatcally): from memory to memory

- (void)setupFetchedResultsController 
{
    NSFetchRequest *request = 
        [NSFetchRequest fetchRequestWithEntityName:@"Photo"];
    request.sortDescriptors = 
        [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"title"
                                                                                     ascending:YES
                                                                                      selector:@selector(localizedCaseInsensitiveCompare:)]];
    request.predicate = [NSPredicate predicateWithFormat:@"whoTook.name = %@", self.photographer.name];

    self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:request
                                                                        managedObjectContext:self.photographer.managedObjectContext
                                                                          sectionNameKeyPath:nil
                                                                                   cacheName:nil];
}
  • 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-09T02:40:20+00:00Added an answer on June 9, 2026 at 2:40 am

    Fetch Request A. Correct.

    Fetch Request B. Almost correct. You don’t know where FRC is getting the data, if it is in memory or has to be retrieved from the store. You don’t have to care, that’s the beauty of FRC.

    Relationship 1. Same Context. Wrong. The context has nothing to do with the relationship. The two entities A and B have to be in the same data model, not context. The context is primarily for fetching and saving.

    Relationship 2. Subset. Wrong. If you fetch entity A, you have access to its relationships, but you do not know how much data is actually being retrieved at which time (this is called faulting). Core data is going to take care of that for you. Because relationships could be set up any way (one-to-many, many-to-many, one-to-one) and could be empty, your statement about subsets is not correct. For example:

    // A --one-to-many--> B
    NSSet *bSet = anAObject.bRelationship; 
    

    In this case the set contains indeed a subset of all B entities (if there are other ones), but you see that this is just a special case. In the above code you can also see how conveniently you can access the relationship entities via dot-notation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I noticed that there are two sets of Hadoop configuration parameters: one with mapred.*
I've noticed that there are two different ways to load nib/xib files: via the
I recently noticed there is two different ways to delete an entry from the
In struts I notice there are two different ways to access variables. I am
I'm new to Ruby on Rails world. I noticed there is at least one
I noticed that there's a whole bunch of different content types, some of them
I am following some examples in the book, and I noticed two different conventions
I noticed that there seems to be a couple of slightly different syntaxes for
I've noticed that there is a different way in Xcode 4.2 to start the
I'm trying to fetch some HTML from various blogs and have noticed that different

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.