Multiple commands produce - swift

I just created a new project, and installed some pods. When I try to build, I get these two errors:
Showing Recent Issues
Multiple commands produce '/Users/myUser/Library/Developer/Xcode/DerivedData/Demo-eobcppugxuuucmefyvotwbqadppx/Build/Intermediates.noindex/Demo.build/Debug-iphonesimulator/Demo.build/Objects-normal/arm64/AppDelegate.stringsdata':
1) Target 'Demo' (project 'Demo') has compile command for Swift source files
2) Target 'Demo' (project 'Demo') has compile command for Swift source files
Showing Recent Issues
Multiple commands produce '/Users/myUser/Library/Developer/Xcode/DerivedData/Demo-eobcppugxuuucmefyvotwbqadppx/Build/Intermediates.noindex/Demo.build/Debug-iphonesimulator/Demo.build/Objects-normal/arm64/SceneDelegate.stringsdata':
1) Target 'Demo' (project 'Demo') has compile command for Swift source files
2) Target 'Demo' (project 'Demo') has compile command for Swift source files

Turns out I had duplicate swift files in targets -> Build Phases Deleted the ones that where duplicates, and all ok

I had the same problem but in my case, I have same name for two swift files. The solution for that is Go to Targets -> Build Phases -> Compile Sources, and check whether you have the same named Swift files, and remove any one from there.
Another issue of this error is under Targets -> Build Phases -> Copy Bundle Resources, if there are same named bundled resources, remove any one from that.

For me it was a view from an app extension, which was named the same as a view from my main app. Renaming the view from the extension solved the issue.

Related

"Build input file cannot be found:" - when running: xcodebuild

error:
Build input file cannot be found: *(this contains the folder and
project info) *.../build/Debug-iphoneos/StaffIS.app/StaffIS'. Did you
forget to declare this file as an output of a script phase or custom
build rule which produces it? (in target 'StaffIS' from project
'StaffIS')
Then it complains that:
The following build commands failed: ExtractAppIntentsMetadata (in
target 'StaffIS' from project 'StaffIS') CopySwiftLibs *(this
contains the folder and project info) *
/build/Debug-iphoneos/StaffIS.app (in target 'StaffIS' from project
'StaffIS') (2 failures)
It compiles just fine in Xcode, never an issue. I don't see any StaffIS files in the project, it is the project name however.
I simply want to run a command-line build without failure.

"Missing Package Product" error in Xcode when adding a new package

After adding a package (Kingfisher) to my Xcode project, I noticed the following error when building:
I am not sure why I am getting this error, because from what I can tell the package was added correctly. I've verified that in the Targets > Frameworks section I see the package Kingfisher listed:
I've also verified that in the Project > Package Dependencies section, I see the package listed:
Furthermore, I even tried to just remove the dependency on this package altogether by removing it from both the Targets > Frameworks section using the "-" button, and I did so as well in the Project > Package Dependencies section. However even after removing it from both of these places I still get the same error when trying to build, which was very surprising.
I'm new to xcode so any help/tips would be appreciated
The problem might as well be in some cached data that still dwell in DerivedData. Try deleting DerivedData for your project and then reinstantiate package again. Also clean build folder with Cmd + Shift + K You can open your DerivedData folder in finder window directly through Xcode by navigating to: Xcode -> Preferences -> Location and clicking on the small arrow next to DerivedData directory.

CocoaPods. podspec. How to generate Swift file in script_phases and then append it to source_files?

I have my own framework. There is a phase with :execution_position => :before_compile in script_phases that generates .swift file.
I've added the filepath of future generated file to source_files.
File was generated while compiling, but not added to compile sources, so it won't be compiled.
How should I fix this?
The similar question, but adding filepath to Output files didn't give the desired effect.
Xcode 10, sourcery & swiftlint build phases order

Create NSManagedObject Subclass... make a new Error in my project

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
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.
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

iOS: Build XYZ.framework with multiple libraries (xyz.a)?

i have build a XYZ.framework package for iOS with the folowing folder-structure:
ls XYZ.framework
XYZ -> Libraries/libxyz.a
Headers -> Home/Headers
Home -> SDKs/Current
Libraries -> Home/Libraries
SDKs
ls XYZ.framework/SDKs
4.2
Current -> 4.2
ls XYZ.framework/SDKs/Current
Headers
Libraries
It works fine with one .a library file.
But how to include more than one .a library file?
0) iOS does not allow you to publish dynamic libs at this time (unless that's a recent change)
1) set up your framework's project to include the dependencies
2) add the depends to the build invocation (target dependencies) and link phase.
3) if your framework creates no objects (e.g. exports no symbols, or compiles no files), then you may need to add a dummy file with something such as an inline function (or the image's constructor/destructor).
4) then link to the static depends to produce the final image. this step should merge all images.