Using Version 8.1 of Xcode.
Create an entity named "MapRegionObject" in .xcdatamodeld file.
Using auto code generator, click Editor on the navigation bar -> create NSManagedOject Subclass...
Got two files : MapRegionObject+CoreDataClass.swift and MapRegionObject+CoreDataProperties
Errors in two files showing in the screenshot:
MapRegionObject+CoreDataClass.swift
MapRegionObject+CoreDataProperties
Please help me fix this bugs, thank you so much!
In Xcode 8.1, before using the auto code generator, you must select the entity in your data model:
Then go to the Data Model Inspector tab:
Under "Codegen" select "Manual/Node"
After that you could create a
NSManagedObject
subclass without errors.Alternatively, if you have already used 'Class Definition', you can go into your existing .xcdatamodeld file and set all current entities to 'Manual/None' under Codegen. Make sure to save your project (File -> Save), delete your existing Derived Data, clean the project, and then build. Resolved it for me without having to re-make my whole model.
This isn't an answer. It's just explanation of what's going on with the selections
Make sure you see this moment for the Core Data Stanford course
Below is a transcript I wrote myself (It's not 100% accurate):
Long story short, I'm not sure why but for some reason if you don't select the create
NSManagedObject
subclass then it seems to still work, but without showing what's happening under the hood. Very counter intuitive!Then also watch this live demo of the Core Data Stanford course:
In Xcode 8.2.1 , Menu-Product-Clean,And every is ok, it's so verid.
The problem is that you don't need to generate NSManagedObjectModel subclasses manually anymore. ref: https://forums.developer.apple.com/thread/48988
Close the project and follow the following instructions:
Save and open Xcode project again.Everything should work well.
1) clean the project (cmd + shift + K)
2) In the "data model inspector" for every created Entity set attributes for Class just as in the screenshot below
3) Generate code again (Editor -> create NSManagedObject Subclasses)
After that everything should work fine.