核心数据迁移 - 找不到迁移的映射模型 [英] Core Data Migration - Can't find mapping model for migration

查看:200
本文介绍了核心数据迁移 - 找不到迁移的映射模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照这里的指南操作:
http:// www.timisted.net/blog/archive/core-data-migration/
,但是当我使用新模型启动应用程序时,仍会收到找不到迁移的映射模型。我试过它在xcode 3和xcode 4,多次,但永远不能得到它的工作。



目前我的选项设置为:

  NSDictionary * options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES],NSMigratePersistentStoresAutomaticallyOption,
[NSNumber numberWithBool:NO],NSInferMappingModelAutomaticallyOption,
nil];

我之前的推断选项设置为YES,但是它只是迁移而不调用我的自定义策略我需要迁移,我认为是因为它之前找不到映射模型。



任何原因我的映射模型没有被拾起?我已经双重检查,通过检查它的SVN版本,对以前的模型没有更改。



谢谢。

解决方案

确定Mapping模型需要是.xcdatamodeld包的一部分,这在xcode 4中是不可能做到的。 / p>

注意:我的映射文件停止工作了,我发现它是0KB的光盘,所以我不得不重新创建它,它工作正常后。我很快就承诺了,会看到它是否再次消失。问题是,Xcode 4索引它或某物,所以它看起来很好在xcode,但在文件系统上它的空。



查看我的注释下面的原因(xcode 4的mapc (映射编译器)已损坏)。



**已在新版XCODE / SDK中固定**


I followed the guide found here: http://www.timisted.net/blog/archive/core-data-migration/ but keep getting "Can't find mapping model for migration" when I start up the app with the new model. I've tried it in xcode 3 and xcode 4, multiple times, but can never get it to work.

Currently my options are set to:

NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
    [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
    [NSNumber numberWithBool:NO], NSInferMappingModelAutomaticallyOption,
    nil];

I had YES set for the infer option before but then it was just migrating without calling my custom policies that I need to migrate, which I assume is cause it couldn't find the mapping model before either.

Any reason my mapping models aren't getting picked up? I've double checked that no changes were made to the previous model by checking it against the SVN version of it.

Thanks.

解决方案

Turns out the Mapping Model needs to be part of the .xcdatamodeld package, which is impossible to do within xcode 4. With it in there, it works great.

Note: my mapping file stopped working again, and I found that it was 0KB on disc, so I had to recreate it again and it worked fine after that. I quickly committed it and will see if it disappears again. The problem is that Xcode 4 indexes it or something so it looks fine in xcode but on the file system its empty.

See my comment below for the reason (xcode 4's mapc (map compiler) is broken).

** THIS HAS BEEN FIXED IN THE NEWER XCODEs/SDKs.**

这篇关于核心数据迁移 - 找不到迁移的映射模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆