[英]Xcode 9.3 Autocomplete for NSManagedObject Subclass not working?
I created a new .xcdatamodeld
file ( New File > Core Data > Data Model
). 我创建了一个新的
.xcdatamodeld
文件(“ New File > Core Data > Data Model
)。 I created an entity let's call it SomeEntityName
and I added its attributes. 我创建了一个实体,我们称其为
SomeEntityName
并添加了其属性。 From there I'm creating an NSManagedObject
in Editor > Create NSManagedObject Subclass...
. 从那里,我在
Editor > Create NSManagedObject Subclass...
创建一个NSManagedObject
。 The creation works and I see the SomeEntityName+CoreDataClass.swift
and SomeEntityName+CoreDataProperties.swift
files but, the autocomplete is not working? 创建成功,我看到
SomeEntityName+CoreDataClass.swift
和SomeEntityName+CoreDataProperties.swift
文件,但是自动完成功能不起作用吗?
I have restarted Xcode, cleaned, rebuilt the project and still no luck. 我已经重新启动了Xcode,进行了清理,重建了项目,但仍然没有运气。
I tried to change the Codegen
to Manual/None
from Class Definition
in the right panel core data inspector but that gives me an error of an undeclared type "EntityName"
我试图在右侧面板核心数据检查器中将
Codegen
从“ Class Definition
更改为“ Manual/None
,但这给了我一个undeclared type "EntityName"
的错误
Is there something I am missing? 我有什么想念的吗?
Edit : In my other Class files, I am able to autocomplete subclass definitions like Codable
or import Foundation
, etc. 编辑 :在我的其他Class文件中,我能够自动完成子类的定义,例如
Codable
或import Foundation
等。
After a couple hours managed to figure out the issue, hopefully no one else runs into this as well: 几个小时后设法解决了这个问题,希望也没有其他人遇到这个问题:
By default when selecting your .xcdatamodeld
file in the project navigator and creating an NSManagedObject via Editor > Create NSManagedObject Subclass...
the location had no targets selected. 默认情况下,当在项目导航
Editor > Create NSManagedObject Subclass...
选择.xcdatamodeld
文件并通过Editor > Create NSManagedObject Subclass...
该位置未选择目标。 You need to select your project and make sure the target is checked. 您需要选择项目,并确保已选中目标 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.