Xcode is looking for core data entity names with dot; not compiling

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.

  • how to change value of dictionary of dictionary effectively and dynamically
  • Getting CFBundleVersion from within Jenkins to use it as a variable, something like ${APP_VERSION}
  • align text using drawInRect:withAttributes:
  • Xcode 7 with iOS 9 device Error: device unavailable (Could not find a developer disk image)
  • AVCaptureSession stopRunning method creates terrible hang
  • Changing the base SDK in Xcode
  • 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

    4 Solutions Collect From Internet About “Xcode is looking for core data entity names with dot; not compiling”

    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)

    • Clean project
    • Clean DerivedData folder

    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:

    • Clean project
    • Clean DerivedData folder
    • Restart Xcode

    This occurs when the module of an entity is set to “Current Product Module” (e.g. to be within the Swift namespace, rather than the global Objective-C namespace).

    The workaround for this is to remove the customization of the “Module” field of the entity, so it has the default value of “Global namespace” (in light gray text).

    I changed the Code Gen from “Category / Extension”

    Change Codegen to Class Definition.

    enter image description here

    Now get rid of whatever you were doing in code to turn your entities into pseudo-classes. Your entities are now real classes!

    You will now be able to pare your code down considerably. You no longer have to cast down to specify an entity type as a class. When you fetch Person objects, your fetch results is a generic parameterized on Person, and so each fetched object is a Person. Similarly, to make a new Person, just call Person(context:) and configure, and save the store. The word “entity” will probably cease to exist anywhere in your code.

    I have solved it. I was about to recontruct the whole app from scratch to avoid whatever the issue was, and I noticed that the entity class files were in the directory, even though they weren’t visible in Xcode. So I deleted those files and that cleared that hurdle.

    I’m very happy now.