简体   繁体   中英

Xcode 10 Error: Multiple commands produce after generating NSManagedObject subclass

I have a project to which I want to use CoreData. I first create the data model - the code compiles fine. Then, I try to generate the NSManagedObject subclasses by going to Editor -> Create NSManagedObject Subclass . The generated files causes Multiple commands produce error when trying to compile.

Since you've generated the NSManagedObject subclasses manually (by going to Editor -> Create NSManagedObject Subclass ), you need to tell CoreData that it shouldn't generate them again when building the project.

You do that by going to your data model file (something like Model.xcdatamodeld ), and on the Data Model Inspector change Codegen from Class Definition to either Category/Extension or (most probably) Manual/None :

在此处输入图片说明

Note: You might have to delete your DerivedData after doing this.

See section "Xcode automatic subclass generation" at What's New In Core Data for more information.

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