Xcode/Swift 'filename used twice' build error
Try to search, if you have added same ViewController - MainController.swift
twice.
If not, then search class MainController
in codebase.
Regarding Pods, it is preferred to use all Pods as frameworks,
So try using 'use_frameworks!'
in your Podfile
, and then from terminal reinstall the pods "pod install
".
File name used twice Xcode
This is most often bugs in Xcode where it gets confused about generated files (I literally ran into this exact problem this morning....)
The solution generally is to close Xcode, delete DerivedData, and reopen Xcode.
DerivedData is in ~/Library/Developer/Xcode/DerivedData/
. You can remove the whole directory, or just the subdirectory related to your project.
"Delete DerivedData" is an incredibly common solution to Xcode problems, and has been for years. Most of us have some kind of alias to simplify it. This is mine:
alias cdd='cd ~/Library/Developer/Xcode/DerivedData/'
filenames are used to distinguish private declarations of the same name' error
The issue is happening because of the Xcode automatic subclass generation feature.
According to What's New In Core Data
Xcode automatic subclass generation
Xcode now supports automatic generation of NSManagedObject subclasses
in the modeling tool. In the entity inspector:
- Manual/None is the default, and previous behavior; in this case you
should implement your own subclass or use NSManagedObject.- Category/Extension generates a class extension in a file named like
ClassName+CoreDataGeneratedProperties. You need to declare/implement
the main class (if in Obj-C, via a header the extension can import
named ClassName.h).- Class Definition generates subclass files named
like ClassName+CoreDataClass as well as the files generated for
Category/Extension.
The generated files are placed in DerivedData and
rebuilt on the first build after the model is saved. They are also
indexed by Xcode, so command-clicking on references and fast-opening
by filename works.
So for fixing your issue, you need to set the Codegen
field value to Manual/None
as shown below:
How can I have 2 files with the same name in my swift project?
You cannot name the files the same. The solution is to include namespaces in filenames, instead of relying on folder structure.
So in your case, the file names would be:
directory1.A
and anotherdirectory.A
.
Xcode 10 Error: Multiple commands produce
The issue might be occurring because of multiple Plist or other files within App-
Solution -> Open target -> Build phases > Copy Bundle Resources and remove info.plist
from there.
Note: If you have developed a watch app too then you will have to remove the plist from the watch and watch-extension too.
Xcode 10 Error: Multiple commands produce
The issue might be occurring because of multiple Plist or other files within App-
Solution -> Open target -> Build phases > Copy Bundle Resources and remove info.plist
from there.
Note: If you have developed a watch app too then you will have to remove the plist from the watch and watch-extension too.
Xcode build error - Multiple commands produce .o, Target 'ProjectCoreData' has compile command for Swift source files listed twice
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:
Related Topics
Cllocationmanager Responsiveness
Perform UI Changes on Main Thread Using Dispatch_Async or Performselectoronmainthread
Opens Apple Maps App from iOS App with Directions
How to Change the App Store's Large Icon on Itunes Connect
Detect and Use Optional External C Library at Runtime in Objective-C
iOS Input Focused Inside Fixed Parent Stops Position Update of Fixed Elements
Detecting If User Has in Call Status Bar
Passing Data to and from an Embedded Uiwebview
In Os X 10.10 (Yosemite Beta), How to Test Using iOS 6.1 Simulator
Marker Click Event on React Native Maps Not Working in React iOS
iOS 11+ How to Migrate Existing Core Data to Shared App Group for Use in Extension
Detect Which App Is Currently Running on iOS Using Sysctl
How to Set Status Bar Tint Color on iOS 6
Ios/Ipados Safari Push API Support
How to Write Application Logs to File and Get Them
Storyboard Instantiateviewcontrollerwithidentifier Not Setting Iboutlets