4

Can anyone explain what's going on here? I have a file I JUST saved from a new version of my application - yet if i close my application and double click that document file, it gives me this error:

The document “main” could not be opened. The managed object model version used to open the persistent store is incompatible with the one that was used to create the persistent store.

Now, I have checked Google for this and it appears to be fairly common, however, I tried the advise of deleting the files in the Application Support Folder (it's folder doesn't exist for some reason) and cleaned all targets from XCode (Build > Clean All Targets) with no luck. The weirdest part is, when I accept the error and take a look at the application it loaded, it's an old version. Where can I find this mystery version of my application and how do I fix it??!

Eimantas
  • 48,927
  • 17
  • 132
  • 168
Zakman411
  • 1,764
  • 3
  • 22
  • 45

2 Answers2

0

I got around this issue by suppressing CoreData version check:

  NSDictionary *options = @{NSIgnorePersistentStoreVersioningOption:@NO}
  NSPersistentStoreCoordinator *coordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:mom];
  if (![coordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:url options:options error:&error]) {
    [[NSApplication sharedApplication] presentError:error];
    return nil;
  }
kleopatra
  • 51,061
  • 28
  • 99
  • 211
0

Just for anyone who's having issues with this - I was also having issues installing the application correctly (when testing for App Store submission), and when looking at Installer Logs, it showed my app in some WEIRD locations on the computer. Delete those and reinstall (or don't, if just debugging from XCode) and problem solved.

Zakman411
  • 1,764
  • 3
  • 22
  • 45
  • 1
    Re location of your managed object model: some documentation says it's in ~/Library/Application Support/YOUR_APP_NAME, but I found mine in ~/Library/YOUR_APP_NAME. If you make a change to your Core Data Model and end up with loading problems, try deleting this directory and rebuilding. – Pete855217 Jan 09 '12 at 08:48
  • 1
    If you can't find the path to your app on OS X 10.7+, when the app is sandboxed, it is stored in: ~/Library/Containers/com.yourcompany.yourAppName/ – Andrew Aug 30 '12 at 19:04
  • I have Mountain Lion 10.8.2 and Xcode 4.5.2 and for some reason the folder was located in: /Users//Library/Developer/Xcode/DerivedData/. After I deleted the app_folder it worked. – schmudu Jan 23 '13 at 01:28