XCode无法编辑CoreData模型 [英] XCode Cant' Edit CoreData Model

查看:150
本文介绍了XCode无法编辑CoreData模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用

文件>添加CoreData模型后,新>文件...>核心数据>数据模型

我无法编辑模型。该项目现在包括.xcdatamodeld程序包引用,但在项目导航器中单击它与单击文件夹或组具有相同的效果,当前编辑器不更改。也右键单击引用并选择打开方式>不列出任何潜在的编辑器。此外,打开文件检查器面板仅列出Identity目标成员资格和文本设置的设置,不会列出核心数据模型或版本化核心数据模型的设置

I am unable to edit the model. The project now includes a .xcdatamodeld package reference, but clicking on it in Project Navigator has the same effect as clicking on a folder or group, the current editor does not change. Also right clicking the reference and selecting "Open As >" lists no potential editors. Furthermore, opening the file inspector panel only lists settings for "Identity" "Target Membership" and "Text Settings", it does not list settings for "Core Data Model" or "Versioned Core Data Model"

这不应该对XCodes识别文件类型的能力有任何影响,但我还在构建阶段引用了CoreData.framework,并在AppDelegate中包含必要的Core Data属性。

Not that this should have any effect on XCodes ability to recognize a file type, but I have also referenced CoreData.framework in build phases, and included the necessary Core Data properties in the AppDelegate.

奇怪的是我在Finder中打开了.xcdatamodeld包,以暴露内部.xcdatamodel(注意没有后面的d)。双击该文件将按预期用Core数据模型编辑器打开XCode。

What's strange is I have opened the .xcdatamodeld package in Finder to expose the internal .xcdatamodel (note no trailing 'd'). Double clicking that file will open XCode with the Core Data Model Editor as expected.

即使陌生人仍然是,我创建了一个新的投影并点击使用核心数据检查框。这样做允许我通过在项目导航器中选择.xcdatamodeld引用来编辑数据模型。因此,我的机器和XCode能够并配置为编辑CoreData文件。

Even stranger still is, I created a new projected and clicked the "Use Core Data" check box. Doing so allowed me edit the data model by selecting the .xcdatamodeld reference in the Project Navigator. Hence my machine and XCode are capable and configured to edit CoreData files.

就像XCode不能使用核心数据,除非原始项目是使用数据复选框。

It's as if XCode is unable to use Core Data unless the original project was created with the "Use Core Data" check box.

有人遇到过此问题,您是否能解决问题,以及如何解决?

Has anyone experienced this issue, were you able to fix it, and how?

谢谢!

推荐答案

结果我试图将数据模型添加到引用要存储的特定文件夹它的孩子。那个文件夹不存在。这导致XCode将数据模型放置在项目根目录中,但同时将其引用为项目根目录上的驻留2目录。甚至odder是XCode没有列出文件丢失,显示为红色。无论哪种方式,XCode在Project Navigator中单击时忽略该文件,因为它并不真正存在于它认为它所在的位置。故事的道德是:检查您的文件路径和配置的组路径。

Turns out I was attempting to add the Data Model to a group which referenced a specific folder in which to store it's children. That folder however did not exist. This cause XCode to place the data model in the project root, but at the same time reference it as residing 2 directories above the project root. What's even odder is that XCode didn't list the file as missing by displaying it in red. Either way XCode ignored the file when clicked in Project Navigator, because it didn't really exist where it thought it did. Moral of the story is: check your file paths and configured group paths.

这篇关于XCode无法编辑CoreData模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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