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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:19:32+00:00 2026-06-11T05:19:32+00:00

I am loading a NSManagedObjectModel model with the initWithContentsOfURL: constructor like this: NSURL *modelURL

  • 0

I am loading a NSManagedObjectModel model with the initWithContentsOfURL: constructor like this:

NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"MyDocument" withExtension:@"momd"];
NSManagedObjectModel *mom = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];

However this only gives me access to the latest/current version of a model. Is it posible to load previous versions with the same momd file? how?

  • 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-11T05:19:34+00:00Added an answer on June 11, 2026 at 5:19 am

    Actually you can load an older version with:

    - (NSManagedObjectModel *)managedObjectModelForVersion:(NSString *)version
    {
            NSURL *modelURL = [[NSBundle mainBundle] URLForResource:[NSString stringWithFormat:@"AppModel.momd/AppModel %@",version] withExtension:@"mom"];
            NSManagedObjectModel *model = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
            return model;
     }
    

    Just replace AppModel with your model name.

    I’m using this to get myself out of a sticky manual migration situation involving iCloud. Searched high and low and couldn’t find this anywhere.

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

Sidebar

Related Questions

I made a simple Core Data Example: NSLog(@Loading...); NSURL *modelUrl = [[NSBundle mainBundle] URLForResource:@CoreDataTest
After loading a PHP template (using jQuery's load function), this simple script won't make
After loading a reference to an assembly with something like: import clr clr.AddRferenceToFileAndPath(r'C:\foo.dll') How
After loading dynamic content to a DIV, I'd like to add a Close option,
while loading getfptex(got it from CTAN) batch file ,when i'm extracting this batch file
When loading an existing document using NSPersistentDocument , as part of initialization I'd like
when loading a .dll file from lua it gives me this error: loop or
Try loading this normal .jpg file in Internet Explorer 6.0. I get an error
When loading this video in Chrome the audio plays super delayed and the video
For loading files like css or javascript of images, I have learned to add

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.