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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:21:33+00:00 2026-06-12T14:21:33+00:00

Short question: I want to run a certain code in my app only if

  • 0

Short question:

I want to run a certain code in my app only if my Core Data model has changed (new entities, new properties, etc). How can I determine if the model has changed or not?

Just some pseudo-code:

    if (current_model_version != previous_model_version) {
    //do some code
    } else {
    // do some other code
    }

I’m guessing I might use versionHashes to do this, or isConfiguration:compatibleWithStoreMetadata:, but I’m not certain how.

Some editing for clarity: ‘current’ as in ‘now’ and ‘previous’ as in ‘last time app was launched.’

  • 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-12T14:21:34+00:00Added an answer on June 12, 2026 at 2:21 pm

    The answer seems to be isConfiguration:compatibleWithStoreMedia:.

    I found some useful information here:

    http://mipostel.com/index.php/home/70-core-data-migration-standard-migration-part-2

    I set it up this way:

    - (BOOL)modelChanged
    {
        NSError *error;
        NSURL * sourceURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"db.sqlite"];
        NSDictionary *sourceMetadata = [NSPersistentStoreCoordinator metadataForPersistentStoreOfType:NSSQLiteStoreType URL:sourceURL error:&error];
        BOOL isCompatible = [[self managedObjectModel] isConfiguration:nil compatibleWithStoreMetadata:sourceMetadata];
    
        return isCompatible;
    
    }
    

    ‘self’ is my shared data store, not that it necessarily has to go there.

    deanWombourne points out that what this really does is determine whether or not the data can be automatically migrated, so it’s not exactly the solution to the problem I posed. It does serve my needs in this case.

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

Sidebar

Related Questions

I have a short question. I want do put this \tssr>&\8=f23' into a String
my question is , I want to get some short and smart ideas to
Short question: Do any of MS's built in Data Objects support INotifyPropertyChanged? Long explination:
I'm working on a new app that I want to be universal for the
I want to run the Visual Studio debugger on a .Net program that has
I'm working on some data access logic with Spring, my question has to do
This question is sort of a sequel to that question. When we want to
Short question, is the following ok: struct X { A& x; A y; X()
Short question: Is it possible to detect window.open() in a UIWebView using the UIWebViewDelegate
Short Question: Can I specify wildcards for custom console folding? If so, what is

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.