15

i want to add a class for my entity by Editor\Create NSManagedObject Subclass... menu . but when i added it , the project made an error , this is the message:

Multiple commands produce '/Users/mohsenkhodadadzadeh/Library/Developer/Xcode/DerivedData/walk-fcnteanemrfigmfaalqkvwigvwqc/Build/Intermediates.noindex/walk.build/Debug-iphonesimulator/walk.build/Objects-normal/x86_64/WalkEntity+CoreDataProperties.o':
1) Target 'walk' (project 'walk') has compile command for Swift source files
2) Target 'walk' (project 'walk') has compile command for Swift source files


Multiple commands produce '/Users/mohsenkhodadadzadeh/Library/Developer/Xcode/DerivedData/walk-fcnteanemrfigmfaalqkvwigvwqc/Build/Intermediates.noindex/walk.build/Debug-iphonesimulator/walk.build/Objects-normal/x86_64/WalkEntity+CoreDataClass.o':
1) Target 'walk' (project 'walk') has compile command for Swift source files
2) Target 'walk' (project 'walk') has compile command for Swift source files

i changed that build system to Legacy Build system in File->Project settings . but it diden't work yet

this project made with xcode9 and i develope it with xcode 10 now

mohsen
  • 4,698
  • 1
  • 33
  • 54

2 Answers2

51

Select the xcdatamodeld file in the project navigator, select the entity and press ⌥⌘3 – in Xcode 13 ⌥⌘4 – to show the Data Model Inspector.

If you created the class manually the Codegen popup must be set to Manual/None otherwise the class file is created implicitly.

vadian
  • 274,689
  • 30
  • 353
  • 361
  • 1
    I also had to clean build folders and relaunch xcode in order for it to recognize my new manually created class. – Jared Mar 30 '19 at 02:59
  • Seems unfair that I can only upvote once on this answer . Thanks – Jim Tierney Jul 29 '19 at 16:48
  • After cleaning, I had to build it first before running it in order to work. Clean is Shift + Command + K and build is Shift + Command + B. Thanks Apple ;) – coolcool1994 Nov 28 '19 at 20:42
  • Works for me, but with some manipulations. If you created files with Class codegen, delete them, set Manual codegen and clean project then build. After this steps all works perfectly. – Vladyslav Shmatok Mar 17 '21 at 13:21
0

In Xcode 11

1.Remove info list from Build Phases > Copy Bundle Resources

2.Remove Created Subclass from Build Phases > Compile Sources

Than Run if its not working use legacy build settings

From: File > Project Settings > build settings > legacy build settings

enter image description here

Ekramul Hoque
  • 672
  • 4
  • 17