Xcode error when attempting to archive project: Unexpected duplicate tasks - ios

My project runs totally fine with no warnings on both the simulator and a real device, but when I try to archive it, I get this error:
Unexpected duplicate tasks:
1) Target 'SwiftDataTables' (project 'Pods') has copy command from '/myAppPath/Pods/SwiftDataTables/SwiftDataTables/SwiftDataTables.bundle/column-sort-descending.png' to '/Users/Marius/Library/Developer/Xcode/DerivedData/myAppName-bvaclcqghnevllgdezgzmpfvrzrz/Build/Intermediates.noindex/ArchiveIntermediates/myAppName/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/SwiftDataTables.framework/column-sort-descending.png'
2) Target 'SwiftDataTables' (project 'Pods') has copy command from '/myAppPath/Pods/SwiftDataTables/SwiftDataTables/SwiftDataTables.bundle/column-sort-descending.png' to '/Users/Marius/Library/Developer/Xcode/DerivedData/myAppName-bvaclcqghnevllgdezgzmpfvrzrz/Build/Intermediates.noindex/ArchiveIntermediates/myAppName/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/SwiftDataTables.framework/column-sort-descending.png'
I get this error 3 times, one for each of the pictures that are in the SwiftDataTables.
I have already tried cleaning the project, uninstalling and reinstalling the problematic library, and removing all the files from Derived Data. From what I have seen from other similar questions, the solution is often checking that a file isn't listed both in Copy Bundle Resources and Compile Sources in target/Build phases, but I can't find any file that is listed twice.
Thanks in advance.

I could fix it by selecting the three images in Xcode and then remove the Target Membership for SwiftDataTables and adding it again.

Try again - In the file navigator you can try searching (Cmd+F) to see
if the files are somehow in the project twice. Try removing entire
framework and any references from the file navigator and the build
settings (check under Frameworks folder, et al), and then re-add. Check the pods files listed in the build
settings. There is a place where the file paths are added for example
if you tried using Carthage previously where the duplication is
occurring.

Related

I cant build an iOS project

When I try to build my project I get this same error
error: Multiple commands produce '/Users/shaka0241/Library/Developer/Xcode/DerivedData/tutores-ckkpuvpkfwcscbfxzqbzibwjihlk/Build/Products/Debug-iphonesimulator/tutores.app/Frameworks/Alamofire.framework':
1) Target 'tutores' has copy command from '/Users/shaka0241/ios-tutores/Carthage/Build/iOS/Alamofire.framework' to '/Users/shaka0241/Library/Developer/Xcode/DerivedData/tutores-ckkpuvpkfwcscbfxzqbzibwjihlk/Build/Products/Debug-iphonesimulator/tutores.app/Frameworks/Alamofire.framework'
2) That command depends on command in Target 'tutores': script phase “Carthage Copy Frameworks”
Clean build folder and try deleting the DerivedData folder (and re-build)
Check all your Info.plist files for any inconsistencies (especially when working with SiriKitIntents)
Check your Target Memberships & frameworks you import
Those solved it whenever I had this problem..
Also possible dup:
Xcode 10 Error: Multiple commands produce

Xcode Buildtime Error: 'Unable to load contents of file list: '.../Info.plist' (in target 'xxxx')

Xcode started throwing this error in a project today, and I'm having trouble figuring out what it means and how to troubleshoot it, and it's not coming up in any searches. It happens immediately after trying to build to a device (no scripts compile, etc):
error: Unable to load contents of file list: '/Users/.../Products/Debug-appletvos/myapp.app/Info.plist' (in target 'myapp')
Full log below, (note I've replaced build folder with ... for brevity)
Showing Recent Messages
Prepare build
note: Using new build systemnote: Planning buildnote: Constructing build description
Build system information
error: Unable to load contents of file list: '/Users/.../Products/Debug-appletvos/myapp.app/Info.plist' (in target 'myapp')
Build failed 3/5/19, 3:09 PM 0.2 seconds
Things I've tried so far:
Restarting Xcode
Restarting Computer
'Product' > 'Clean Build Folder'
Manually deleting everything in Build folder
Re-download repository on the same computer (same issue)
Re-download repository on a different computer (same issue)
reverting to a previous commit that was working (same issue)
plutil Info.plist responds with Info.plist: OK
Other items of note:
Project uses Cocoapods
Project utilizes custom C++ code
The only file list in the Info.plist file is a list of 2 custom fonts, but those are showing up ok in the Xcode project browser (not red).
If anyone has encountered this before and has a fix, or has any other suggestions for troubleshooting I would greatly appreciate it, thanks!
In my case, I just fixed below
Open terminal under project folder
pod deintegrate
sudo gem install cocoapods-clean
pod clean
Open the project and delete (if it's still there) the “Pods” folder that should be red
pod setup (This may take some time)
pod install
I fix this in this way:
1、Go to your project's target, -> Build Phases -> Embed Pods Frameworks
2、check the input files and input file lists, Output files, and output file lists.
3、move dir from input file lists to input files, and output file lists to output files
I realised after a while that my colleague has updated cocoapods to the latest version, so what I did was just
sudo gem install cocoapods
And that did the trick! :)
Finally figured this out, posting here so others googling can find it.
It was an issue with a build script that used the 'Input File Lists' option, removing and re-adding the script fixed the issue.
Nav to Target
'Build Phases' tab
'Run Script' phase
make notes of what's there, remove it
re-run to make sure things work
re-add the script (and content under 'Input File Lists')
The problem is that you have added path to Input File Lists instead of Input Files
In my case
pod deintegrate
pod install
was enough
In my case, I just fixed below
1- Go to your project's target, -> Build Phases -> Delete [CP] Copy Pods Resources.
2- pod deintegrate.
3- pod install.
First, you work:
Delete the .xcworkspace file
Delete the Podfile.lock file and Pods/ directory
Keep the Podfile
Rerun pod install
If the error still occurs, you need to add include .xcconfig path for CocoaPods in your .xcconfig files by prepending an #include statement like the following: #include “Pods/[path .xccofig file in Terminal”
Example:
I have two environments Stag and Production
After I run the pod file in Terminal. You’ll see in Terminal that CocoaPods did not set the configuration since we already set custom configurations. CocoaPods provides a link to be included in each
Open .xcworkspace file and select .xcconfig file
Finally, Cmd + Shift + K and run project
Good luck!!!
No need to deintegrate pods and install again. Just run
pod install
It will create necessary files for new configurations.
In my case, Xcode was using a Build Configuration that didn't exist anymore. Going to 'edit scheme...' and selecting a valid scheme fixed it for me.
In my case, the problem wasn't about cocoapods, it was about Fabric
I removed row $(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH) from Build Phases > Fabric > Input File Lists and it fixed the error

iOS Swift No Such File or Directory In Debug-iphoneos

Somebody please save me.
This is the error I'm getting. I've tried cleaning, doing a build clean, pod installs and updates. I have not found a solution.
Shell Script Invocation Error Group
/Users/arthuraraujo/Library/Developer/Xcode/DerivedData/Anti-Social_Club-gizjofrkxroutxezxlbuadlvpwbo/Build/Products/Debug-iphoneos/Anti-Social: No such file or directory
I have similar issues in the past and doing the following work for me. Hope your problem is same as mine:
Close xCode
Go to this folder Group
/Users/arthuraraujo/Library/Developer/Xcode/DerivedData/Anti-Social_Club-gizjofrkxroutxezxlbuadlvpwbo/Build/Products/Debug-iphoneos/
and delete Anti-Social.
Restart xCode, clean & build.
It is hard to really tell you the solution with just the information provided. However, the first thing I would try is deleting the derived data, as CodeBender stated. You should also look at your search paths in your project's building settings to make sure your pods are correct/ connecting your pods files to your project.
Possible duplicate of:
Xcode 8 Shell Script Invocation Error
Here is what I did when I got this:
Used this site to completely remove All Versions of cocoapods:
https://superuser.com/questions/686317/how-to-fully-uninstall-the-cocoapods-from-the-mac-machine
Re-installed current stable version of cocoapods (v1.1.1 for me)
Deleted podlock and pods directory
Deleted old .xcworkspace file (this was key for me).
Did "pod install"
Opened xcode and cleaned project and deleted derivedData.
Go to your build phases and remove libReact.a from the linked libraries.
Then add libReact.a but select this one:
libReact.a from 'React' target in 'Pods' project

Invalid bundle structure - The app may contain only one executable file.

This question is similar if not identical but there is no solution. I've looked inside the archive and there's only one executable, so I am at a loss as to how to proceed. Any ideas greatly appreciates.
Invalid Build Structure
The binary file 'YourApp.app/libYourLibrary.a' is not permitted.
Your app may contain only one executable file.
This error occurs when a static library file is mistakenly copied into the app bundle.
You should link the libYourLibrary.a static library via a Link Binary with Libraries build phase.
It should NOT be added to the target's Copy Bundle Resources build phase.
My app was rejected with the same error message. It turned out that I was copying a third party framework (Fiksu) in the 'Copy Bundle Resources' build phase. The framework contained an executable and was already linked to in the 'Link Binary With Libraries' build phase. I deleted the framework from the 'Copy Bundle Resources' build phase. The framework continued to work normally in a release build. I resubmitted the app and it passed validation. Similar solution was posted here:
https://devforums.apple.com/message/1020254#1020254
In hindsight the error is straightforward. An executable file was accidentally added to the project. In my case "Develop!.app/Xcode" meant that Xcode was the executable. Checking the list of files in the project I found a symlink to Xcode. (Maybe I dragged it from the dock somehow and dropped it into the project).
If you are getting this error look at the files in your project -- there is an executable there somewhere.
I had this issue for the first time on an app I'd submitted over several versions with no issues.
I found that somehow that although I'd linked to one of my own libraries, one of the source files from that same library appeared in the list of files in the "Copy Bundle Resources" list. I have no idea how it got there but removing it meant that my app build, archived and was submitted successfully. :-)
If you are getting error in following format:
"Invalid Bundle Structure - The binary file 'Abc.app/AnyFileName.o' is not permitted.
Build Phases > Copy Bundle Resources > check your file AnyFileName.swift will be added too here. (Remove it)
validate it with XCode. Error gone !!
In my case I tried to remove references but nothing worked for me. Then I uninstall particular pod, remove references as mentioned here and then install that particular pod again. It worked for me.
For those who required elaboration check below:
1)
In Podfile comment the particular pod by adding # in the beginning and save it:
On command line run: pod install // It will uninstall that framework
2) Removed references of that framework from:
Link Binary with Libraries // In Build Phase
Copy Bundle Resources // In Build Phase
Embed Frameworks
3) Now install Pod again, Remove # which you added before and save it.
On command line run: pod install // It will install that framework again
Just delete the exec file from your bundle and delete the "Executable file" key from your bundle resources.
After that archive and validate the the the build it will work.

xcodebuild failure clang:error no such file or directory:

Having a problem when building with xcodebuild. My project/app builds fine with the Xcode - gui. It simply isn't finding/building the libcryptopp library which is part of the build process.
The error is:
clang: error: no such file or directory: '/Users/builder/repo/ioskpay/xcode-cryptopp/cryptopp/build/Release-iphoneos/libcryptopp.a'
This particular file should be derived from another project inside the main app - xcodebuild simply isn't correctly pointing at the right file folder which should be:
~/Library/Developer/Xcode/DerivedData
Any ideas?
To fix this, go to your project settings, go to Targets and select your main project target. Then go to Build phases. Under Target dependencies add the static library project.
This way, when you compile the main project, the static library subproject gets compiled before the main project and your static library will be available.
I had the same problem, but for a resource file .m
I opened target -> build phases -> Compile sources
and I found the file the compiler was tell it can't find duplicated: one with strange icon and the other with a normal icon. I simply removed the one with strange icon and it worked. ( I added the file multiple times and I had a merge conflict before that which made something wrong in the project file)
For your case I think you need to remove the lib from target dependencies list and add it again. This may work for you.
In Xcode Version 9.2 (9C40b) this happened when I drug a bunch of files into the project, some of which were duplicate. Rather than simply not adding the duplicates, it added them again and only the name, not the path.
In Target > Build Phases > Compile Sources each of the duplicates showed with no "...in" after them. Each one caused the clang error.
After removing all of the duplicates that Xcode collected, the project compiled and ran.
It makes you use the Project Navigator instead of managing your source files in the Finder. Then the Project Navigator can't replace duplicates like any decent file management system (ahem Finder). 🤨
My xCode info is:
I faced similar errors during xcode building projects (native swift, flutter, react native, native script) in which I got error messages related to clang compilar. Errors like:
clang-4.0: error: no such file or directory: '/Users/xxxxxxxx/Library/Developer/Xcode/DerivedData/xxxxxxxxxxxxxxx/Index/Data Store'
clang-4.0: error: cannot specify -o when generating multiple output files
others
Despite of errors related with DerivedData for native apps can be fixed by deleting the directory and, eventually, restart xCode and even restart the machine... in this case, you will see that after deleting the directory and start building process again, the error comes back.
Then, is the moment of checking the clang installation by running clang --version. The normal output will be something like:
as you can see the InstalledDir is incorrect for xCode. In my case, some days ago I needed to install Anaconda app (R, Python, etc) and, now, I remember that I had to install some dependencies and one of them was clang and its installation was altered.
To fix this problem (in my case that I will not need anaconda any more): (edited)
1.- Delete anaconda and all its dependencies (I recommend to use App Cleaner).
2.- Re-install xCode
After reinstalling xCode, if you type again clang --version, you'll get this:
More info at: https://github.com/flutter/flutter/issues/32457#issuecomment-496161092
Hopefully, this info helps some else.
Best
Ok so by simply adding the correct -target -configuration and -scheme parameters I got this to run correctly. However due to my running this in Jenkins for autobuild purposes it still doesn't work as I'd like - getting stuck in exactly the same place. It's odd because I have the exact same code being built in another job that isn't having this problem. There is no rhyme or reason for it at this point. I will keep shooting rubber bands at it and update when I have an answer...
Sometimes Xcode performs weird.
You have to find that static library project e.g.. "filename.a" under 'Link Binary With Libraries' in Build Phase and then remove it and add it again.
I had the same problem while I was archiving my target. I removed the library and the build succeeded.
For me it was because I had removed a package or pod. I ran pod install and it fixed it
Look for the missing file in the Xcode project i.e the files may be deleted or miss placed.
add the missing files to the xcode, then everything will work fine.
Run this command :
$ conda deactivate

Resources