Today I tried the swift CoreData encountered a strange problem:
When you run the project, you will be prompted to not find the class file that corresponds to the entity, but in the entity, the file is actually created and actually exists
Run to this place, Xcode will not die, and when clicked "Step Over", will continue to execute
When I want to output the results, I will also prompt: Nsarray element failed to match the swift array element type
How to debug can not pass, and later after looking for data to know, need to be added to the file corresponding to the entity:
@objc (Classfile)
For example, my entity's file is info, so I'll add
Import Foundationimport COREDATA@OBJC (Info) class info:nsmanagedobject { @NSManaged var name:string @NSManaged var location:string}
Once added, errors that were previously prompted to find the class file do not exist.
The strange question of Swift CoreData