简体   繁体   中英

xcode8 header not found using NSManagedObject subclass in CoreData

Thanks for having a look :)

I am using xcode 8.2.1 and the language is obj-c. I simply created two entities(Photo and Photographer) and after I did editor - create NSManagedObject Subclass there went error in the files generated.

One is in Photo+CoreDataClass.m saying "Photographer.h file not found".

Another one is in Photographer+CoreDataClass.m at the line saying "Photo.h file not found".

All the files that were generated were:

Photographer+CoreDataClass.h/m,
Photo+CoreDataClass.h/m
Photographer+CoreDataProperties.h/m
Photo+CoreDataProperties.h/m

The tools version minimum is Xcode 7.3 and codegen is None/Manual

Could anyone tell me how to fix this?

Ps, the entity's relationship is that one Photographer to-many Photo, and Photo to-one Photographer

Just rename your files

Photographer+CoreDataClass.h/m,

to

Photographer.h/m

and

Photo+CoreDataClass.h/m

to

Photo.h/m

then copy the properties from the other two classes into the renamed ones then remove them.

在选择.xcmod​​eld文件后,通过将Class部分设置为空来消除此错误

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM