我有一个应用程序设置了核心数据和一个名为" subject"的实体,当我尝试将另一个实体添加到名为" homework"的核心数据时,我的应用程序崩溃了,我得到这个错误
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)
我不确定自己做错了什么,我已将其设置为从实体中获取数据&#34; subject&#34;使用此代码
var appDel:AppDelegate = (UIApplication.sharedApplication().delegate as AppDelegate)
var context:NSManagedObjectContext = appDel.managedObjectContext!
var request = NSFetchRequest(entityName: "Subject")
request.returnsObjectsAsFaults = false;
如果只有一个实体,那就完美无缺。 先谢谢
答案 0 :(得分:0)
正如有人在评论中建议的那样,尝试从模拟器中删除该应用并重新安装。如果仍然失败,则将您为数据模型创建的NSManagedObject文件与实际数据模型中的文件进行匹配。可能是您创建了文件然后更改了模型。