Xcode 正在寻找带点的核心数据实体名称;不编译 [英] Xcode is looking for core data entity names with dot; not compiling

查看:12
本文介绍了Xcode 正在寻找带点的核心数据实体名称;不编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在做一个项目,最近升级到 Xcode 8 和 Swift 3.0 和 iOS 10.但自从我这样做以来,我一直无法编译.

我的每个实体都出现错误::0:错误:没有这样的文件或目录:''/Users/mark/Library/Developer/Xcode/DerivedData/.../.Account+CoreDataProperties.swift'每个案例都有一个 .实体名称前的(点)前缀:.Account+CoreDataProperties.swift.

我将代码生成从类别/扩展"更改为手动/无,我做了一个干净整洁的目录,删除了 DerivedData 目录.有趣的是,当我查看适当的目录时,那里有一个实际文件,只是没有点前缀.

这很令人困惑.谁能解释一下?我需要解决这个问题才能继续使用核心数据.

TIA标记

解决方案

点文件由 Xcode8 生成.请参阅

注意:即使您在项目中看不到生成的文件,Xcode 也有对它的引用,因此您可以编写扩展程序等.例如:

extension MyEntity {func doSomething() {//}}

此外,您可以在 Xcode 中命令+单击生成的文件.

2) 一种相当偏执但经得起考验的方法,忽略了新的 Xcode 功能

  • 从项目中删除所有生成的 NSManagedObject 子类(如果存在).
  • 在您的 .xcdatamodel 中将所有实体的 Codegen 设置为 Manual/None
  • 清理项目
  • 清理派生数据文件夹
  • 重启Xcode
  • 手动生成 NSManagedObject 子类(在编辑器"菜单中)
  • 确保将这些文件添加到您的项目中
  • 构建

如果问题仍然存在,请重复:

I have been working on a project for a while, and recently upgraded to Xcode 8 and Swift 3.0 and iOS 10. But since I did that I have not been able to compile.

I am getting an error for each of my entities: :0: error: no such file or directory: ''/Users/mark/Library/Developer/Xcode/DerivedData/.../.Account+CoreDataProperties.swift' Each case has a . (dot) prefix before the entity name: .Account+CoreDataProperties.swift.

I changed the Code Gen from "Category / Extension" to Manual / None, I do a clean and clean directory, an delete the DerivedData directory. Interestingly, when I look in the appropriate directory there is an actual file there, just without the dot prefix.

This is very confusing. Can anyone explain it? I need to solve this to be able to continue with core data.

TIA Mark

解决方案

The dot files are generated by Xcode8. See WWDC2016. I ran into the same issue after having to delete derived data due to another issue.

Two possible fixes:

1) The recommended, modern approach

  • Delete all generated NSManagedObject subclasses from your project, if exists.
  • Set Codegento Class Definition in your .xcdatamodel for all entities
  • Make sure Module is empty ("Global Namespace" in light gray) (workaround an Apple bug, see @Chris Hansons answer)

Note: Even you do not see the generated files in your project, Xcode has a reference to it, so you are able to write extensions and such. For instance:

extension MyEntity {
    func doSomething() {
        //
    }
}

Also, you can command+click to the generated file within Xcode.

2) A rather paranoid but bullet-prove approach, ignoring the new Xcode features

  • Delete all generated NSManagedObject subclasses from your project, if exists.
  • Set Codegento Manual/None in your .xcdatamodel for all entities
  • Clean project
  • Clean DerivedData folder
  • Restart Xcode
  • Manually generate NSManagedObject subclasses (in "Editor" menu)
  • Make sure those files are added to your project
  • build

If your problem persists, repeat:

这篇关于Xcode 正在寻找带点的核心数据实体名称;不编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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