现在两者都在同一个工作空间,所以不需要2个模型,因为它们是99%相似的.所以我想将.xcdatamodeld包的名称更改为allApps.xcdatamodeld.我可以重命名它,但是在这样做时,我没有找到关于迁移行为的任何参考.
这是错误 –
2015-07-28 09:04:06.079 Appname[51306:1423128] CoreData: error:-addPersistentStoreWithType:sqlite configuration:(null) URL:file:///Users/shani/library/Developer/CoreSimulator/Devices/EA75A69F-B108-4036-AB3D-B923F83D16DE/data/Containers/Data/Application/B1CB3AF3-DEF4-40DF-9A61-721063ECBB1D/documents/Appname.sqliteoptions:{ NSInferMapPingModelautomaticallyOption = 1; NSMigratePersistentStoresautomaticallyOption = 1; NSsqlitePragmasOption = { "journal_mode" = WAL; }; } ... returned error Error Domain=NSCocoaErrorDomain Code=134130 "The operation Couldn’t be completed. (Cocoa error134130.)" UserInfo=0x7fc39c194360 {URL=file:///Users/shani/library/Developer/CoreSimulator/Devices/EA75A69F-B108-4036-AB3D-B923F83D16DE/data/Containers/Data/Application/B1CB3AF3-DEF4-40DF-9A61-721063ECBB1D/documents/Appname.sqlite,Metadata={ NSPersistenceFrameworkVersion = 519; NsstoreModelVersionHashes = { Attempt = <b4d1e878 69a97917 e751a67c 89e1887a ae4df1dc f380e4ee c9585f60 f39ff51e>; BookmarkFlashcard = <33112f7c 2fa20bec eb2e019c b5d619b4 92be2547 a65fabee 1ac86ab7 92dd77bb>; BookmarkQuestion = <38634b49 71f0d43c 6f9fbba9 bc2f1b81 675c9b3c f2da017e fc8de9d8 4e18a4a0>; category = <b0e4d91b 0c0ebc71 ed0f403c 9a0eec20 fc1686aa 0169bc60 4bcc7e57 165bce15>; }; NsstoreModelVersionHashesversion = 3; NsstoreModelVersionIDentifIErs = ( "" ); NsstoreType = sqlite; NsstoreUUID = "F1B37CD0-8B89-4893-A262-1013C3544026"; "_NSautoVacuumLevel" = 2; },reason=Can't find model for source store} with userInfo dictionary { URL = "file:///Users/shani/library/Developer/CoreSimulator/Devices/EA75A69F-B108-4036-AB3D-B923F83D16DE/data/Containers/Data/Application/B1CB3AF3-DEF4-40DF-9A61-721063ECBB1D/documents/Appname.sqlite"; Metadata = { NSPersistenceFrameworkVersion = 519; NsstoreModelVersionHashes = { Attempt = <b4d1e878 69a97917 e751a67c 89e1887a ae4df1dc f380e4ee c9585f60 f39ff51e>; BookmarkFlashcard = <33112f7c 2fa20bec eb2e019c b5d619b4 92be2547 a65fabee 1ac86ab7 92dd77bb>; BookmarkQuestion = <38634b49 71f0d43c 6f9fbba9 bc2f1b81 675c9b3c f2da017e fc8de9d8 4e18a4a0>; category = <b0e4d91b 0c0ebc71 ed0f403c 9a0eec20 fc1686aa 0169bc60 4bcc7e57 165bce15>; }; NsstoreModelVersionHashesversion = 3; NsstoreModelVersionIDentifIErs = ( "" ); NsstoreType = sqlite; NsstoreUUID = "F1B37CD0-8B89-4893-A262-1013C3544026"; "_NSautoVacuumLevel" = 2; }; reason = "Can't find model for source store"; } 2015-07-28 09:04:06.089 Appname[51306:1423128] CoreData: annotation:NSPersistentStoreCoordinator's current model hashes are { Attempt = <b4d1e878 69a97917 e751a67c 89e1887a ae4df1dc f380e4ee c9585f60 f39ff51e>; BookmarkFlashcard = <33112f7c 2fa20bec eb2e019c b5d619b4 92be2547 a65fabee 1ac86ab7 92dd77bb>; BookmarkQuestion = <38634b49 71f0d43c 6f9fbba9 bc2f1b81 675c9b3c f2da017e fc8de9d8 4e18a4a0>; category = <b0e4d91b 0c0ebc71 ed0f403c 9a0eec20 fc1686aa 0169bc60 4bcc7e57 165bce15>; }
有没有办法在已经在生产中的应用程序中将name1.xdatamodel重命名为name2.xdatamodel?
谢谢
解决方法 而不是重命名app1.xcdatamodeld或app2.xcdatamodeld,您应该创建一个新的(allApps.xcdatamodeld).这个新的一个模型可以只是一个你想要保留的模型的副本.然后在两个目标的每个目标中添加一个.xcmapPingmodel文件并将其链接到allApps.xcdatamodeld并执行任何所需的翻译.
coreData的工作方式,您将需要保留原始的app1和app2 xcdatamodeld文件,以确保您永远不会破坏您的最旧应用程序仍然在其设备上运行的用户.
文件>新>文件>核心数据>映射模型
选择源模型,然后单击下一步.
选择目标数据模型,然后单击下一步.
在你的另一个目标app2再次这样做,你应该可以.
总结以上是内存溢出为你收集整理的ios – 重命名coredata .xcdatamodeld文件和迁移全部内容,希望文章能够帮你解决ios – 重命名coredata .xcdatamodeld文件和迁移所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)