0

I have an app set up with core data and one entity named "subject", when I try to add another entity to core data called "homework", my app crashes and I get this error

    2014-10-04 12:41:05.302 HomeJournal[1050:20160] Unresolved error Optional(Error Domain=YOUR_ERROR_DOMAIN Code=9999 "Failed to initialize the application's saved data" UserInfo=0x7fe6bb60cac0 {NSLocalizedFailureReason=There was an error creating or loading the application's saved data., NSLocalizedDescription=Failed to initialize the application's saved data, NSUnderlyingError=0x7fe6bb524760 "The operation couldn’t be completed. (Cocoa error 134100.)"}), Optional([NSLocalizedFailureReason: There was an error creating or loading the application's saved data., NSLocalizedDescription: Failed to initialize the application's saved data, NSUnderlyingError: Error Domain=NSCocoaErrorDomain Code=134100 "The operation couldn’t be completed. (Cocoa error 134100.)" UserInfo=0x7fe6bb524720 {metadata={
    NSPersistenceFrameworkVersion = 519;
    NSStoreModelVersionHashes =     {
        Subject = <e90676da 933291ac ffe738ee ec80ba71 d2cc14a0 df80b9fe b69b358c 43d4cebc>;
    };

    NSStoreModelVersionHashesVersion = 3;
    NSStoreModelVersionIdentifiers =     (
        ""
    );
    NSStoreType = SQLite;
    NSStoreUUID = "CB1FC120-99D2-4DB2-9C08-D6679CC6ECB7";
    "_NSAutoVacuumLevel" = 2;
}, reason=The model used to open the store is incompatible with the one used to create the store}])
(lldb) 

I'm not sure what I did wrong, I have it set up to get the data out of the entity called "subject" using this code

 var appDel:AppDelegate = (UIApplication.sharedApplication().delegate as AppDelegate)
        var context:NSManagedObjectContext = appDel.managedObjectContext!
        var request = NSFetchRequest(entityName: "Subject")
        request.returnsObjectsAsFaults = false;

Which works perfectly if there is only one entity. Thanks in advanced

Richard Beattie
  • 293
  • 1
  • 3
  • 17

1 Answers1

0

As someone suggested in comment, try deleting the app from simulator and re-install. If it still fails then match the NSManagedObject files you created for your data models to that in actual data models. It may be the case that you created files and then changed the models.

rkb
  • 10,933
  • 22
  • 76
  • 103