2

I deleted the Objective-C files that Core Data generated from the data model, so I could go back to the swift files that I had generated in Xcode 7. When deleting the files, I had the files moved to the trash, and added the swift files back in to the project. I'm using Xcode 8.0.

The error I get is

"error: no such file or directory", for the missing files, one of which is Luna.build/DerivedSources/CoreDataGenerated/Luna/.LunaObservation+CoreDataClass.m. There are corresponding errors for LunaObservation+CoreDataProperties.m and LunaOrbit+CoreDataClass.m, but not LunaOrbit+CoreDataProperties.m.

I don't see the file's name in the build phase's compile sources. I've tried cleaning the project and deleting the derived data without success.

Update: I finally figured out how to generate Swift files instead of Objective-C files, but I'm still getting the error that it's looking for the deleted Objective-C files.

Update #2: I was able to reduce the number of errors after cleaning the project and deleting the entire derived data file; I no longer get errors for the missing .m and .h files, but I do get a single error about two missing files: .Orbit+CoreDataProperties.swift and .Observation+CoreDataProperties.swift. These files exist, but they don't have the period in front of the name. Attempting to add the period to the file name results in a "Rename failed" message. Both files had an extra "import" after the others that didn't import anything--the line just ended.

The post XCode 8 generates broken NSManagedObject subclasses for iOS 10 shows pretty much the problem I'm having.

Community
  • 1
  • 1
Scamp Dog
  • 68
  • 1
  • 8

1 Answers1

2

In the Data Model inspector, try setting the Module option to "Current Product Module" (instead of Global Namespace). This will add the period to the generated NSManagedObject subclass name.

enter image description here

You can see the result of this action by looking in the Configuration section. The class name will be prefixed with the period.

enter image description here

A more detail response can be found here: https://stackoverflow.com/a/40647786/4748172

Community
  • 1
  • 1
Ryan H.
  • 2,543
  • 1
  • 15
  • 24