xcodebuild command crashed from extension assets - swift

When I run a build using fastlane or xcodebuild, I get an error:
"The following build commands failed:
Compile As set Catalog /Users/admin/Library/Developer/Xcode/DerivedData/.../Intermediate Build Files Path/UninstalledProducts/iphoneos/LotteriesWidget.appex .../ LotteriesWidget/Resources/Assets.xcassets"
Assets.xcassets Location set in "Relative to Group", changing this setting produces no results.
This error exists if Assets.xcassets are Copy Bundle Resources for my Today Extension. If you move them to the application target, the build and archiving succeeds, but the resources are not displayed.
How can I fix this ?

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.

Swift Package Manager failed extracting

I'm getting this Package Manager error, when switching to a different branch or cloning the project. Build fails and "Clean Build Folder" doesn't help.
Error:
failed extracting
'https://releases.amplify.aws/aws-sdk-ios/AWSConnect-2.26.6.zip'
which is required by binary target 'AWSConnect':
.../Library/Developer/Xcode/DerivedData/MyApp-cbgtlihuudupsqdzyjdbyvcwkilh/SourcePackages/artifacts/extract/AWSConnect
is not a directory
The following steps resolve the issue forcing all packages to download.
Product > Clean Build Folder
Delete DerivedData content (Preferences > Locations > Derived Data little arrow)
File > Packages > Reset Package Cache
Build
The Reset Package Cache step is the most important here. It forces all packages to download as if they where just added.
Another issue that can happen is if you have added a build configuration, make sure that you have replicated this build configuration name throughout all your in house libraries, frameworks and sub projects. If the project that uses your Library has no build configuration for the scheme you are building then it will not link and you will receive errors like:
failed extracting 'https://github.com/*.xcframework.zip' which is required by binary target 'BlahBlah': fchmod (file attributes) error: Operation not permitted

Getting 'Multiple commands produce' error with duplicate output file warning in Xcode 13.0

I am getting below multiple commands produce error while running the application in Xcode 13.0.
Multiple commands produce '/Users/XYZ/Library/Developer/Xcode/DerivedData/AppName-dsntzothkrspqbfirwzgyvntjirn/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/GoogleAppMeasurement/AdIdSupport/GoogleAppMeasurement.framework':
1) That command depends on command in Target 'GoogleAppMeasurement' (project 'Pods'): script phase “[CP] Copy XCFrameworks”
2) That command depends on command in Target 'GoogleAppMeasurement-AdIdSupport' (project 'Pods'): script phase “[CP] Copy XCFrameworks”
And also getting duplicate output file warning as mentioned below: -
duplicate output file '/Users/XYZ/Library/Developer/Xcode/DerivedData/AppName-dsntzothkrspqbfirwzgyvntjirn/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/GoogleAppMeasurement/AdIdSupport/GoogleAppMeasurement.framework' on task: PhaseScriptExecution [CP] Copy XCFrameworks /Users/asif.raza/Library/Developer/Xcode/DerivedData/AppName-dsntzothkrspqbfirwzgyvntjirn/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/GoogleAppMeasurement-AdIdSupport.build/Script-CAAD1E7A7F15E98CC87B30D71A33FD1C.sh
Could someone please help me out to resolve this issue?
Thanks in advance.
Solution found: After removing below ‘Pods_AppName.framework’ from ‘Link Binary With Libraries’ in Build Phases as showing disabled. Removed all derived data then Clean Build folder and and run.

pod trunk push - error: Unexpected duplicate tasks

I'm trying to create a new cocoapod which I built.
I've tried everything I know, playing with the build settings, playing with build phases and even starting a fresh new empty project - nothing helped, and I keep getting the following errors:
error: Unexpected duplicate tasks:
1) Target 'IdFramework' (project 'Pods') has copy command from '/var/folders/j7/zvtf1r056n37blpr07lwpg_80000gr/T/CocoaPods-Lint-20210520-91577-hknniq-IdFramework/Pods/IdFramework/IdFramework/Info.plist' to '/Users/{username}/Library/Developer/Xcode/DerivedData/App-bmefgfaejhpjtdfjtbeehlmhmllt/Build/Products/Release-iphonesimulator/IdFramework/IdFramework.framework/Info.plist'
2) Target 'IdFramework' (project 'Pods') has copy command from '/var/folders/j7/zvtf1r056n37blpr07lwpg_80000gr/T/CocoaPods-Lint-20210520-91577-hknniq-IdFramework/Pods/IdFramework/IdFramework/Info.plist' to '/Users/{username}/Library/Developer/Xcode/DerivedData/App-bmefgfaejhpjtdfjtbeehlmhmllt/Build/Products/Release-iphonesimulator/IdFramework/IdFramework.framework/Info.plist'
warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')
warning: duplicate output file '/Users/{username}/Library/Developer/Xcode/DerivedData/App-bmefgfaejhpjtdfjtbeehlmhmllt/Build/Products/Release-iphonesimulator/IdFramework/IdFramework.framework/Info.plist' on task: ProcessInfoPlistFile /Users/{username}/Library/Developer/Xcode/DerivedData/App-bmefgfaejhpjtdfjtbeehlmhmllt/Build/Products/Release-iphonesimulator/IdFramework/IdFramework.framework/Info.plist /var/folders/j7/zvtf1r056n37blpr07lwpg_80000gr/T/CocoaPods-Lint-20210520-91577-hknniq-IdFramework/Pods/Target Support Files/IdFramework/IdFramework-Info.plist (in target 'IdFramework' from project 'Pods')
** BUILD FAILED **
I checked again and again, and there's nothing under Copy Bundle Resources - In fact the project gets compiled fine in XCode. I also tried to use the Legacy Build System - without success.
I'm using the latest version of cocoapods, with XCode 12.1.
What can possibly be the issue?

iphone: Building error precompiling app_prefix.pch

I dont know what happened to Xcode. I was debugging my app when after a while of writing some code I tried to compile and an error message appeared:
Building error precompiling app_prefix.pch
arm-apple-darwin9-gcc-4.2.1: te: no such file or directory
I had never this error before, and I am not sure how to solve it.
Did you move your [Project Name]_prefix.pch file ? If you moved it to say, a subdirectory of the project's parent, you need to open up the target Build settings for each of your targets by double clicking on them, do a search for "pch" in the build settings, and update the path to the .pch file.
For example, if you moved your .pch file to a subdirectory "Core" which is in the project parent, then you'd change "[Project Name]_prefix.pch" in the build settings to "Core/[Project Name]_prefix.pch".
Try to change the buid setting of the target in project propertys:
Change the option Precompile prefix header to "NO"