Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Core data 与两个核心数据实体的快速崩溃_Core Data_Swift_Entity - Fatal编程技术网

Core data 与两个核心数据实体的快速崩溃

Core data 与两个核心数据实体的快速崩溃,core-data,swift,entity,Core Data,Swift,Entity,我有一个应用程序设置了核心数据和一个名为“主题”的实体,当我尝试向核心数据添加另一个名为“家庭作业”的实体时,我的应用程序崩溃,我得到了这个错误 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" UserIn

我有一个应用程序设置了核心数据和一个名为“主题”的实体,当我尝试向核心数据添加另一个名为“家庭作业”的实体时,我的应用程序崩溃,我得到了这个错误

    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) 
如果只有一个实体,它就可以完美地工作。
如有人在评论中建议的那样,请尝试从模拟器中删除应用程序并重新安装。如果仍然失败,则将为数据模型创建的NSManagedObject文件与实际数据模型中的文件进行匹配。可能是您创建了文件,然后更改了模型。

删除设备上的应用程序,然后重建项目。它应该可以解决您的问题。@POB Thank完美地工作了@POB的可能副本它的答案是相同的,但不是问题保存模型的问题,但这个问题是关于多个实体的
 var appDel:AppDelegate = (UIApplication.sharedApplication().delegate as AppDelegate)
        var context:NSManagedObjectContext = appDel.managedObjectContext!
        var request = NSFetchRequest(entityName: "Subject")
        request.returnsObjectsAsFaults = false;