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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:57:41+00:00 2026-06-07T14:57:41+00:00

I am saving various entities into core data. Each time I need to access

  • 0

I am saving various entities into core data. Each time I need to access this data I am reading from Core data and assigning the required entity to a mutable array.

if (managedObjectContext == nil) 
{ 
    managedObjectContext = [(iForgetAppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext]; 
}
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Event" inManagedObjectContext:managedObjectContext];
[request setEntity:entity];
NSError *error = nil;
NSMutableArray *mutableFetchResults = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy];
if (mutableFetchResults == nil)
{
    // Handle the error.
    NSLog(@"mutableFetchResults == nil");
}
[self setEventsArray:mutableFetchResults];
[eventsTableView reloadData];

The problem is, I am retrieving this data from many different pages in the app.

What is the best practice when using Core Data? Should I just load the data in the App Delegate and assign the arrays there?

All advice is greatly appreciated.

  • 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-07T14:57:46+00:00Added an answer on June 7, 2026 at 2:57 pm

    Your setup with mutable arrays is already bad practice. Core data can sort, filter and display, arguably much better than mutable arrays.

    You should consider using a NSFetchedResultsController to display your data. You can do the filtering and sorting by using predicates and sort descriptors. Such a solution should be infinitely more robust and scalable.

    As for your specific question about saving, you can use the managed object context (keep a reference in your class or get it from the app delegate) to save that data anywhere.

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

Sidebar

Related Questions

I'm importing ~18,000 records of various entities that are related to each other from
between saving a key name like this for(var key in this.data) { var key_name
I'm saving data to a table, but I also need a column with a
I need to do some trimming before saving various fields in our database. We're
I got from various sources that Facebook stores The start and end time of
I have a number of data classes representing various entities. Which is better: writing
I've seen various questions here pertaining to saving NSArrays/NSDictionaries, but I'm a bit confused
After saving a String value into memcached using the Danga client, I attempted to
When saving a new entity something strange happens... I have a data grid with
I'm saving a struct into a .dat file. Lets suppose I have to edit

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.