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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:53:59+00:00 2026-05-16T01:53:59+00:00

I am developing a backup/restore system for my app in which the user can

  • 0

I am developing a backup/restore system for my app in which the user can download a backed-up version of the core data store (sqlite file) and replace the currently-used data store with the downloaded file. However, once the user downloads the file and replaces the current data store, none of the data appears to have been updated. But when the app is quit & re-launched, the restored data is available. How can I force my app to reload the core data store’s file?

I have tried to access the app delegate from my UIViewController which restores the data, like so, to rebuild the core data stack and propogate it across all view controllers in the navigation stack:

MyAppDelegate *app = [[UIApplication sharedApplication] delegate];
app.managedObjectContext = nil;
app.persistentStoreCoordinator = nil;
app.managedObjectModel = nil;
managedObjectContext = [app managedObjectContext];

NSArray *controllers = [self.navigationController viewControllers];
UIViewController *c;
for (int i = 0; i < [controllers count]; i++) {
    c = [controllers objectAtIndex:i];
    [c setManagedObjectContext:managedObjectContext];
}

But this isn’t working, it only throws the following error when I go back to the root view controller: 'The NSManagedObject with ID:0x5d79060 <x-coredata://D8E73D64-C9BA-4CFA-9213-F8BD61749155/MyObject/p2> has been invalidated.'

Does anyone know how to force the app to reload the data and begin working with the new data store file?

  • 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-05-16T01:54:00+00:00Added an answer on May 16, 2026 at 1:54 am

    What I think is tripping you up is the fact that even though you can set all your managed object contexts, store coordinators, and the like to nil, you still have to completely recreate every managed object in use that was based off those objects.

    Your best bet is to do what you’re doing now, but also find a way to destroy every Core Data object that you’ve used. Maybe you can pop your various view controllers down to the root and reload that controller from scratch, so that it uses your new Core Data stack? You’ll lose a certain amount of user-friendliness (since they’ll have to rebuild the view controller stack using the new data you’ve loaded), but you’ll be sure that you’ve destroyed everything you need to.

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

Sidebar

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.