本文介绍了找不到映射模型(Cocoa 错误 134140)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,我有一个版本化的 xcdatamodel,我正在从 V2 迁移到 V3

Basically, I have a Versioned xcdatamodel and I am migrating from V2 to V3

我使用自定义策略创建了一个 映射模型.

I created a Mapping Model with a custom policy.

一旦 PersistenStoreCoordinator 尝试完成其工作,我遇到了 Cocoa 错误编号 134140(找不到用于迁移的映射模型)

Once the PersistenStoreCoordinator tries to do its job, I hit a Cocoa Error No. 134140 (can't find mapping model for migration)

这个问题基本上与我遇到的相同,但我使用的是 Xcode 4.6.3

This Question basically is the same one I'm having but I am using Xcode 4.6.3

我尝试过的事情:

  • 根据此 问题
  • 从 Xcode 中删除 xcdatamodelId 引用并将它们添加回来 (此问题的答案)
  • 清理和清理构建文件夹选项
  • Forcing the xcmappingmodel to reside inside the xcdatamodelId and ensuring my mapping model is not 0kb in size as per the answer of this question
  • Removing the xcdatamodelId references from Xcode and adding them back (answer of this question)
  • Clean and Clean Build Folder options

EDIT 如果有人感兴趣,这里是我的调试语句...

EDIT Here are my debug statements if anyone is interested...

Handling DB Upgrade
sourceMetadata is {
NSPersistenceFrameworkVersion = 419;
NSStoreModelVersionHashes =     {
    OriginalPicture = <ce8de6ad c694b569 dcc1d706 d4df3928 05052cab 14a092f1 340cbf01 2306e861>;
    PanoramicInfo = <923298fa 0af16c01 d5ba91ca 19c6252c 8adee68a bfe7b86b 75285500 6883a1aa>;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers =     (
    ""
);
NSStoreType = SQLite;
NSStoreUUID = "F83640F3-8686-438F-97CC-48311EB74B9C";
"_NSAutoVacuumLevel" = 2;
}

Not Compatible Models Migration is NEEDED!
SourceEntity: OriginalPicture: <ce8de6ad c694b569 dcc1d706 d4df3928 05052cab 14a092f1 340cbf01 2306e861>
DestinationEntity: OriginalPicture: <ce8de6ad c694b569 dcc1d706 d4df3928 05052cab 14a092f1 340cbf01 2306e861>
SourceEntity: PanoramicInfo: <923298fa 0af16c01 d5ba91ca 19c6252c 8adee68a bfe7b86b 75285500 6883a1aa>
DestinationEntity: PanoramicInfo: <1d7836cd f3ccf5fa 487c1984 e2b3f46c abc3b706 c06512d5 0bac698c a5d8cb20>
The operation couldn’t be completed. (Cocoa error 134140.)

第二次编辑

我一直在尝试使用以下方法直接获取映射模型:

I've been trying to get the Mapping Model directly by using:

NSURL *fileURL = [[NSBundle mainBundle] URLForResource:@"Update23Model" withExtension:@"cdm"];

但奇怪的是 fileURL 指向 nil.....

But strangely fileURL points to nil.....

那么如何将映射模型添加到包中?

How do you add the mapping model to the bundle then?

推荐答案

看起来像一个 Xcode 4.6.3 错误...xcmappingmodel 似乎不能在任何组文件夹中......

Looks like an Xcode 4.6.3 bug...The xcmappingmodel must not be inside any group folder it seems....

当我在 xcode 项目的根级别创建它时,IDE 找到了映射.

When I created it at the root level of the xcode project, the mapping was found by the IDE.

这篇关于找不到映射模型(Cocoa 错误 134140)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 10:33