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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:31:09+00:00 2026-05-18T08:31:09+00:00

I have Core Data application and I have been migrating (upgrading) the core data

  • 0

I have Core Data application and I have been migrating (upgrading) the core data model. Each time I create a new version I create a mapping model for each version.
Right now I have 16 versions and I have mapping models that go like this:
1to2.xcmappingmodel
2to3.xcmappingmodel
3to4.xcmappingmodel
…etc. up to 16

This works fine, but a problem arises when one user has a data file with version 10 and updates the application that has version 16. Some how I thought Core Data will automatically upgrade from 10 to 16, but an error shows up that says “Missing Mapping Model”. To make sure the mapping models where correct, I upgrade it to each version one by one (10 to 11, 11 to 12, etc..) and it did work…
Here is my code.

I specify the model version with this code:

NSBundle *modelWrapper = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"TaskApp_DataModel" ofType:@"momd"]];
NSString *modelPath = [modelWrapper pathForResource:@"TaskApp_DataModel 16" ofType:@"mom"];
NSLog(@"%@",modelPath);
managedObjectModel = [[NSManagedObjectModel alloc]initWithContentsOfURL:[NSURL fileURLWithPath:modelPath]];

And I define the Migrate Automatic option here:

  NSURL *url = [NSURL fileURLWithPath: [applicationSupportDirectory stringByAppendingPathComponent: @"storedata-sql"]];


NSMutableDictionary *dict = [NSMutableDictionary dictionary];
[dict setObject:[NSNumber numberWithBool:YES] forKey:NSMigratePersistentStoresAutomaticallyOption];



if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType 
                                            configuration:nil 
                                            URL:url 
                                            options:dict 
                                            error:&error]){

Does anyone know how to upgrade this?
Thank you.

  • 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-18T08:31:10+00:00Added an answer on May 18, 2026 at 8:31 am

    it will only try to go from the users existing version(possibly v1), to the current version. if you have 3 versions then you need maps for v1-v2,v2-v3,v1-v3. have all of the 16 versions shipped?
    if so you may need to start making new migration maps, it may also be worth enabling automatic migration if you haven’t tried it before, as it can be very good at filling in the gaps. i think it is:

    [dict setObject:[NSNumber numberWithBool:YES] forKey:NSInfersMappingModel];

    but you will have to double check that.

    sorry to be the bringer of bad news

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

Sidebar

Related Questions

I've been working on importing XML into an iPad Core Data application. I have
I'm trying to write an application with Core Data, and I have been able
I have been building a core data application to administrate some data and I've
I have a core data application which uses a navigation controller to drill down
I have a Core Data based mac application that is working perfectly well until
I have an application that uses Core Data that has a relationship that I
I have an application that uses Core Data. I have two data models in
i have a tableview application loaded with core data feltching objects and i wanna
I have an application that stores images as NSData in Core Data. I load
I have an existing iPad application to which I've just added core data versioning.

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.