0

Something is wrong with Core Data on Xcode 9.2 (Sierra 10.12.6). Literally nothing works and I get tons of errors on a single screen. I changed codegen to none/manual on all of the entities, but I still get the errors. Here is a picture.

Image of my code with errors on virtually every line:
Image of my code with errors on virtually every line

Has anyone else gotten this or figured out how to fix this?

Makyen
  • 31,849
  • 12
  • 86
  • 121
  • 1
    If codegen is set to manual all `+CoreDataClass.swift` files are missing. Select the `xcdatamodeld` file and in menu `Editor` select `Create NSManagedObject Subclass` to create them. – vadian May 01 '18 at 17:08
  • I did that too, sadly. If I don't add them, then I don't get the errors. These errors are from the generated files, notice how I have them in a folder called "CoreData" – Gavin Craft May 01 '18 at 19:28
  • Please add code, errors and data as **text** ([using code formatting](//stackoverflow.com/editing-help#code)), not just images. Images: A) don't allow us to copy-&-paste the code/errors/data for testing; B) don't permit searching based on the code/error/data contents; and [many more reasons](https://meta.stackoverflow.com/a/285557). In general, code/errors/data in text format >>>> code/errors/data as an image >> nothing. Images should only be used, *in addition to text in code format*, if having the image adds something significant that is not conveyed by just the text code/error/data. – Makyen May 01 '18 at 20:15
  • In this case, your image of the errors does provide some additional information. However, it would greatly improve search-ability to have a good selection of the resulting errors in text format. The goal of SO is to have questions and answers that are useful to people in the future. This means that it's important for people to be able to find your question when they are having a similar problem. Having errors in text format *greatly* improves this. – Makyen May 01 '18 at 20:18
  • Did you by chance create the project, add the entities, and build it _before_ you created the `NSManagedObject` subclasses? If so, **Product ➙ Clean** should fix the issue. – theMikeSwan May 01 '18 at 20:19

1 Answers1

0

OK, So my project was just messed up. I fixed it by making a new project and dragging the old assets into it. It worked

Glorfindel
  • 21,988
  • 13
  • 81
  • 109