I am running xCode Version 10.1 (10B61), Mojave 10.14 (18A391)
Searching shows similar issue in Xcode 10 greater than a year ago, but no issues since then. The solution from last year seemed to be switching to legacy mode, but that doesn't work now. It appears the source code that is stored on my desktop is conflicting with code that is in 'DerivedData', I'm not sure why this would suddenly pop up so randomly.
I see this problem go away if I remove the last model added in Core Data. It seems to trigger when I add a relationship to another object. It's apparently random.
Any advice on how to fix this issue so I can develop?
Multiple commands produce '//Library/Developer/Xcode/DerivedData/ProjectCoreData-ehjvvgovpitmbcegzopwciptfafr/Build/Intermediates.noindex/ProjectCoreData.build/Debug-iphonesimulator/ProjectCoreData.build/Objects-normal/x86_64/Contact+CoreDataClass.o': Target 'ProjectCoreData' (project 'ProjectCoreData') has compile command for Swift source files Target 'ProjectCoreData' (project 'ProjectCoreData') has compile command for Swift source files
from the logs:
<unknown>:0: error: filename "Contact+CoreDataClass.swift" used twice: '/Users/<user>/Desktop/ProjectCoreData/Contact+CoreDataClass.swift' and '/Users/<user>/Library/Developer/Xcode/DerivedData/ProjectCoreData-ehjvvgovpitmbcegzopwciptfafr/Build/Intermediates.noindex/ProjectCoreData.build/Debug-iphonesimulator/ProjectCoreData.build/DerivedSources/CoreDataGenerated/ProjectCoreData/Contact+CoreDataClass.swift' <unknown>:0: note: filenames are used to distinguish private declarations with the same name <unknown>:0: error: filename "Contact+CoreDataProperties.swift" used twice: '/Users/<user>/Desktop/ProjectCoreData/Contact+CoreDataProperties.swift' and '/Users/<user>/Library/Developer/Xcode/DerivedData/ProjectCoreData-ehjvvgovpitmbcegzopwciptfafr/Build/Intermediates.noindex/ProjectCoreData.build/Debug-iphonesimulator/ProjectCoreData.build/DerivedSources/CoreDataGenerated/ProjectCoreData/Contact+CoreDataProperties.swift' <unknown>:0: note: filenames are used to distinguish private declarations with the same name Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
To elaborate a bit: This error is happening because Xcode 10's new build system is better at catching project configuration issues. Issues like these can sometimes cause subtle problems with your build, so it's good to fix them. – Rick Ballard Jun 6 '18 at 17:39
Solution 1:In Xcode, go to File ➼ Project/Workspace settings.➼ Change the build system to Legacy Build system. Solution 2 :Open target ➼ Build phases ➼ Copy Bundle Resources ➼ remove info.plistfrom there.
1) Target ' MyApp ' (project ' MyApp ') has compile command for Swift source files 2) Target ' MyApp ' (project ' MyApp ') has compile command for Swift source files The root cause can be seen by expanding the Compile Swift Source Filessection of the Build Transcript. For example:
Try this Its Working : In Xcode, go to File->Project/Workspace settings. Change the build system to Legacy Build system. Share Follow answered Sep 13 '18 at 6:52 Akash PatelAkash Patel 32733 silver badges22 bronze badges 1 3
The reason you see this error is because Core Data creates these files by default, but you can't see them in Project Navigator. Then you create a duplicate (in Editor/Create NSManagedObject Subclass). As a result you have your error.
According to What's new in Core Data here is a picture with the solution:
For future users : If you are using core data and If you copied entity using option+drag, then ensure that entity name and class name must be same. None of the solutions mentioned over internet worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With