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

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

问题描述

在使用

<代码>文件>新 >文件... >核心数据数据模型

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

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').双击该文件将按预期使用核心数据模型编辑器打开 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 无法使用 Core Data 一样,除非原始项目是使用使用 Core Data"复选框创建的.

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 个目录.更奇怪的是,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天全站免登陆