简体   繁体   中英

Xcode 9.3 Autocomplete for NSManagedObject Subclass not working?

I created a new .xcdatamodeld file ( New File > Core Data > Data Model ). I created an entity let's call it SomeEntityName and I added its attributes. From there I'm creating an NSManagedObject in Editor > Create NSManagedObject Subclass... . The creation works and I see the SomeEntityName+CoreDataClass.swift and SomeEntityName+CoreDataProperties.swift files but, the autocomplete is not working?

I have restarted Xcode, cleaned, rebuilt the project and still no luck.

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"

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.

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. You need to select your project and make sure the target is checked.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM