Xcode 10 Error: Multiple commands produce for 'app' and 'appex' - ios

I got the recently discussed "Xcode 10 Error: Multiple commands produce..." error, but for the resulting app and appex file of my project. Does anyone have an idea what this means. My project has one app and two extensions (only one is part of the error).
Showing Recent Messages
Prepare build
note: Using new build systemnote: Planning buildnote: Constructing build description
Build system information
error: Multiple commands produce '/Users/xxx/Library/Developer/Xcode/DerivedData/MyApp-enqofdpadskdcgemmhrzsxahnjet/Build/Products/Debug-iphoneos/MyApp Dev.app':
1) Target 'MyApp Dev' has create directory command with output '/Users/xxx/Library/Developer/Xcode/DerivedData/MyApp-enqofdpadskdcgemmhrzsxahnjet/Build/Products/Debug-iphoneos/MyApp Dev.app'
2) That command depends on command in Target 'MyApp Dev': script phase “[CP] Copy Pods Resources”
Build system information
error: Multiple commands produce '/Users/xxx/Library/Developer/Xcode/DerivedData/MyApp-enqofdpadskdcgemmhrzsxahnjet/Build/Products/Debug-iphoneos/MyApp Dev Share Extension.appex':
1) Target 'MyApp Dev Share Extension' has create directory command with output '/Users/xxx/Library/Developer/Xcode/DerivedData/MyApp-enqofdpadskdcgemmhrzsxahnjet/Build/Products/Debug-iphoneos/MyApp Dev Share Extension.appex'
2) That command depends on command in Target 'MyApp Dev Share Extension': script phase “[CP] Copy Pods Resources”
Build system information
warning: ignoring duplicated output file: '/Users/xxx/Library/Developer/Xcode/DerivedData/MyApp-enqofdpadskdcgemmhrzsxahnjet/Build/Products/Debug-iphoneos/MyApp Dev.app' (in target 'MyApp Dev')
Build system information
warning: ignoring duplicated output file: '/Users/xxx/Library/Developer/Xcode/DerivedData/MyApp-enqofdpadskdcgemmhrzsxahnjet/Build/Products/Debug-iphoneos/MyApp Dev Share Extension.appex' (in target 'MyApp Dev Share Extension')
Build failed 18.09.18, 10:28 4.5 seconds
I know I can go back to the legacy build system, but I would prefer using the new and faster build system. Thank you for any help.

In case someone is still struggling with this after updating cocoapods and reinstalling pods:
Open Build Phases of the target which gives you problems
Open Copy Pods Resources phase.
Make sure the Output Files is empty. In my case I had a strange entry ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}. I removed it and the build was successful

Solved my problem by updating Cocoapods from 1.4.0 to 1.5.3

I was able to fix it by opening the Runner workspace project in Xcode 10. Then navigate to File, Workspace Settings and change the build system to Legacy Build System.

My Cocoapod version was already 1.5.3(latest).
Just running "pod install" (or "pod install --no-repo-update" if you don't want to update existing pods) solved it for me.

My workaround:
Check your pod version pod --version.
Update Coacoapods to latest version - v1.5.3 if it's not, by running sudo gem install cocoapods
Update all your pods by running pod update
Remove duplicate info.plist file from Target>Build Phases>Copy
Bundle Resources if any.

set "Build System" to "Legacy Build System" in "Shared Workspace Settings" which you can find in "File --> Workspace Settings"

Works form me:
Update Cocoapods
Delete pod file (Don't forgot to copy the contents some where else, so you can restore it)
Delete workspace project file
Delete lock pod file
Delete pod directory
Close the Xcode
Initialise pod
Install pod
Open the workspace project.

One of a possible issues causing the "Multiple commands produce" error may be several targets with conflicting module name. In my case I had a main application target and a notification service extension target with the same Product Module Name, so Xcode was trying to create two ModuleName.swiftmodule files, two ModuleName.swiftdoc files etc. Changing notification service extension module name fixed the problem.

You might have ran into this CocoaPods issue which is caused by this Xcode issue
This reply might help you, it suggest to specify the subspecs explicitly in your Podfile.
For example use pod 'SDWebImage/Core' instead of pod 'SDWebImage'
Apparently, this causes the build product path to always contain the subspec name which might fix the issue.

The key was to do pod deintegrate and rm *.workspace file !

In my case, there was duplicate reference in Copy Bundle Resources of App Target.
I just removed one of them and it worked.

If your error is not gone by updating cocoa pods then simply create new project but change folder location. you will not get this error.

I had a problem like this . . . The solution worked for me was
Go to your Project Target and delete the dupicate reference of your file under the Copy Bundle Resources.
Hope this helps!!!

My problem was rather unique.
I had a unit testing target that had a host application as "Target1"
I had a separate ui testing target that had a host application as "Target2"
I also had Target2 being capable of testing using both my test targets.
The solution was to remove the unit test target from Target2 test (inside edit scheme).
I could also have both my testing targets use the same host application (which I will)

For me, it was a scheme that lost its PRODUCT_NAME after a merge conflict.
To know if this is your problem, you can go to build settings and search for PRODUCT_MODULE_NAME if you see one of your schemes missing it, that's your problem. for me, I fixed it by adding PRODUCT_NAME = <my app's product name like shown under other schemes> to <appName>.xcodeproj/project.pbxproj under the relevant scheme.
But you can probably get it done in Xcode's build settings

I had the same problem with Xcode 10 GM. In my case below solution worked.
Check-in Project -> Build Phases -> Copy Bundle Resources have files with the same name. Just remove the repetitive file

Related

Xcode 11 Error: Multiple Commands produce... when trying to archive with new build system

I try to archive my app with the new Build System in Xcode. I tried to update the pods, but this didn't help. I don't see whats going wrong with this.
This is the error I get when trying to Archive.
Multiple commands produce '/Users/damianvandekauter/Library/Developer/Xcode/DerivedData/Peral-gccnzsgqesdkhpgldsjorooqirpb/Build/Intermediates.noindex/ArchiveIntermediates/Peral/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Parse.bundle':
1) Target 'Parse-iOS12.0-Parse' has create directory command with output '/Users/damianvandekauter/Library/Developer/Xcode/DerivedData/Peral-gccnzsgqesdkhpgldsjorooqirpb/Build/Intermediates.noindex/ArchiveIntermediates/Peral/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Parse.bundle'
2) Target 'Parse-iOS9.0-Parse' has create directory command with output '/Users/damianvandekauter/Library/Developer/Xcode/DerivedData/Peral-gccnzsgqesdkhpgldsjorooqirpb/Build/Intermediates.noindex/ArchiveIntermediates/Peral/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Parse.bundle'
I know I can go back to the legacy build system, but I would prefer using the new and faster build system. Thank you for any help.
Removing duplicate font files in Copy Bundle Resources worked for me.
The problem seems to be caused by the new autolinking feature in React Native 0.60 - the line use_native_modules! in ios/Podfile means when you do pod install, any pods found in node_modules are automatically linked. This means that links to all font files are added to [CP] Copy Pods Resources when you do pod install.
If you previously installed react-native-vector-icons manually by adding the font files to Copy Bundle Resources, you then get a "Multiple commands produce..." fatal build error.
So to fix the problem, just remove the font files from Copy Bundle Resources, so that they are only in [CP] Copy Pods Resources.
Copy Bundle Resources can be found under the Build Phases` tab in the target in your project
the error will be solved

Error - linker command failed with exit code 1

I'm new to XCode Mac and IPhone development. So probably I'm missing something obvious here.
While trying to build the project I'm getting the following warnings and error. I can't figure out what is wrong here, I've looked at this answer and checked my Framework Search Path value and there is none in BuildSettings.
ld: warning: directory not found for option '-F/Users/macbook/Desktop/<app_name>__main/build/Release-iphoneos'
ld: warning: directory not found for option '-F/Users/macbook/Desktop/<app_name>__main/build/Debug-iphoneos'
ld: framework not found Pods_<app_name>
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've been banging my head for several hours now and finally given up.
The path mentioned in the error does not exist and when I looked into where build folder is located in XCode project, I realized they are in a shared directory ~/Library/Developer/Xcode/DerivedData. So I don't understand why XCode is looking for these files in the project's relative path, where build folder doesn't exist.
I'm using
XCode 10.1
CocoasPod 1.5.3 1.8.4
MacOS High Sierra
Note: The same workspace builds successfully on another system.
Edit:
If I copy the project.pbxproj from the other system onto this one, the project on this machine builds successfully too. project.pbxproj is located under *.xcodeproj file.
Also if I select Generic iOS Device the project builds fine, but as soon as I switch to any other target device I get the same error.
Edit 2:
I see a couple of framework files in red in the left side folder/directory's panel.
Foundation.framework
Pods_<application_name>.framework
Solution:
So right now I've found a solution what I believe to be a workaround and not the actual solution.
In my project's folder structure I saw multiple .framework files in red. some of them had different extensions then the ones present in the xCode package. So I updated them with the newer extension files and that got rid of most of the red file frameworks and left just one Pods_.framework the same framework in the error above. I removed the framework from the Libraries and Framework list in the General section. After I did that project build fine and I was able to run the app.
However, I noticed the Pods_<app_name>.framework file is always regenerated after running pod install. So I have to manually remove this unwanted dependency from the list each time starting a new workspace which is pain to say the least.
And so now I'm looking for a way to correct this so I don't have to remove the Pods_<app_name>.framework file each time.
While I was searching for the solution I found a closed cocoapods bug which reported the same issue for an older version. I've lost the thread and cannot find it again otherwise I would've linked the bug.
As noted in one of the answer's comment I now have updated cocoapods version 1.8.4.
Edit 3:
Podfile
# Uncomment this line to define a global platform for your project
# platform :ios, '7.0'
# Uncomment this line if you're using Swift
use_frameworks!
target '<app_name>' do
pod 'Google-Mobile-Ads-SDK', '~> 7.39.0'
end
Based on your comment and build logs I believe the podfile Pods_<application_name> is not available to your project(its added but not downloaded).
Pods are a way to share code across projects and maintain versioning.
You just need to update the pod so that it gets downloaded and added to your project. For that just launch Terminal app, cd to your project folder and fire pod update (you may refer to https://freakycoder.com/ios-notes-12-how-to-update-pods-249ecf88fe57)
If you do not have pod installed you can head to https://guides.cocoapods.org/using/using-cocoapods.html
I used to run into that problem once but I already solved it the same way #alxlive answer and it worked.
The problem happened to me because of the pod that we already installed.
During that time, I already installed my cocoapod for my project. Then, I added 2 new Build Configurations.
Your problem might be the same because you did mention copying others project.pbxproj from other system and it made your project work fine. So that might be the case.
By deintegrate and install the pod back on, that will solve the problem.
Xcode has different build system for simulator and real devices. So it will generate different app for both. If you select any Simulator target then it will builds app for simulator and if you select Generic iOS Device or any real device target then it will builds different build.
May be you are using some frameworks which are builded for iOS devices, So
follow this steps,
Differentiate that frameworks which gives you an error and remove that pods from your pod file and run pod install command and delete DerivedData.
Download that framework's code in your system.
Add project files of framework in your workspace. For that you can refer this and this.
If you don't want to add whole code of framework in your project then you can add particular( for device or simulator ) build of framework in your xcode project.
For that follow this steps,
Open your downloaded project of framework.
Select any simulator target and build project.
Get generated .framework file from Products folder.
Add this framework in your project like this.
Now build your project for simulator.
Follow above steps for devices target if you want to build for devices.
For Google Mobile Ads you can follow this guidelines. Add the -ObjC linker flag to Other Linker Flags in your project's build settings
I hope this will work for you.
Adding -ObjC $(inherited) in the Other Linker Flags fixes my issue
For me it was due to having a space in the Configuration name like "Development Debug". Once I removed the space and made it "DevelopmentDebug", the error message went away.
The pods need to be installed once per mac. The configuration set in the project.pbxproj depends on the Cocoapods version and the Xcode version on the machine.
Try the following:
1 - Delete the Podfile.lock file and the Pods folder from the local project
2 - Delete the content of the Derived Data folder: ~/Library/Developer/Xcode/DerivedData
3 - Run the command:
pod deintegrate
4 - Run the command
pod install
5 - Run the project again

Framework not found GoogleToolboxForMac

After I update my Firebase via "pod update", I got error like this :
ld: warning: directory not found for option '-F/Users/bennysantoso/Library/Developer/Xcode/DerivedData/FCM-atfcxuircoryufazlomgwfgmvaqm/Build/Products/Debug-iphonesimulator/GoogleToolboxForMac'
ld: framework not found GoogleToolboxForMac
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here my Podfile :
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
target 'BB' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for BB
target 'BBTests' do
inherit! :search_paths
# Pods for testing
end
target 'BBUITests' do
inherit! :search_paths
# Pods for testing
end
end
Does anybody know about this error?
I seek out relationships GoogleToolboxForMac and Firebase, but I just get a little bit of information.
FYI, I use Swift 2.3 and Firebase 3.8.0.
I will be grateful for any help you can provide. Thanks!
I had the same error. Once you install the pods, you'll see the following message.
[!] Please close any current Xcode sessions and use MyApp.xcworkspace
for this project from now on.
I didn't notice this for the first time and was trying to build the project using the regular xcodeproj file. After I saw this message, I opened the right project and it worked fine.
Once you open this project you'll notice that you have two subprojects. One would be your project, and another would be the Pods project.
Framework Not Found
When using Pods, we usually face this issue.
There are two main reasons for this
When we open the .xcodeproj file instead of .xcworkspace as mentioned by izaaz-yunus in this Answer
When Build Active Architecture Only is set to Yes in Build Settings
This applies to the projects target and also to all the targets in the pod project
Main Project Screenshot
Pod Project Screenshot
Select Build Settings (of main project, pod project both)
Select each Target one by one
Set Build Active Architectures to No for each target
Finally clean and rebuild your project.
In my case all integration are well-done and also did try so many time to remove and reinstall pod but did not get success.
Finally try with below step
Projetc->Manage Schemes -> Select check box "Pods-MyProjectName"
And get success.
GoogleToolboxForMac is a dependency of Firebase/Messaging. Details in the podspec. When doing "pod update", Cocoapods should set up your workspace to build and link GoogleToolboxForMac.
It sounds like something about your workspace is in a bad state. Does Product -> Clean help? What about deleting Derived Data and the ModuleCache (Xcode -> Preferences -> Locations -> Derived Data)?
It shouldn't be necessary, but you could also try explicitly adding pod 'GoogleToolboxForMac/Logger' to your Podfile.
its work's
1. select your project in directories
2. select General
3. Add "GoogleToolboxForMac.framework" to the Linked "frameworks and Libraries"
This was fixed by adding $(inherited) in the Build Settings -> Search for LIBRARY_SEARCH_PATHS.
This is understandable, since when updating your pod file for the latest versions of libraries which your project depends on, the debug output tells you where you need to add all the $(inherited) flags:
LIBRARY_SEARCH_PATHS
OTHER_LD_FLAGS
GCC_PREPROCESSOR_DEFINITIONS
Go to : target -> Build Settings -> Other Linker Flags -> remove framework "GoogleToolboxforMAC" and build the project.
I had the same issue when I tried to run it on my device. On the simulator it was working fine. I tried some of the above but it didn't work for me. I checked that I was working on .xcworkspace instead of .xcodeproj file, so I tried this one. Follow these steps to:
Open Xcode project (cocoapods project) using .xc... file.
Select Pods project in the project navigator (blue icon on left).
Under Targets, ensure Pods-ProjectName (blue icon) is selected.
Navigate to Build Settings and set the iOS Deployment Target on which iOS version you are going to run project.
Note:It is same as what you set in Project->Targets->Deployment info->Deployment Target.
Maybe someone get benefitted from this.
If you're facing the same error, in your XCode, go to:
Your Project > your target > Scroll down to Linked Framework and Libraries and check if the Library entry is dimmed:
If so, remove and add it again. In my case, I had duplicated entries and one of them was dimmed (when XCode can't find them on disk).
Closed the project that I was trying to build after I did pod install then opened the .workspace and then everything builds perfectly.
Open the your-project.xcworkspace in your project destination.
1)Open terminal -> 2) $cd /project_destination -> 3) $open your-project.xcworkspace
or just open the file in finder
Make sure your "Build Active Architecture settings" for both your project target and the pod are same. Setting NO in both these cases fixed my issue.
My issue was that I had a /bin/sh script that copied specific Pods which didn't exist. This was one of them. Removing the script resolved the build issue.
-I search in harddrive for the GoogleToolboxForMac files, found in :
/Users/Marco/Documents/iosapps/BomRetiro/Bom Retiro/Pods/Target Support Files
And then i copied the files to this folder :
/Users/YourHomeFolder/Library/Developer/Xcode/DerivedData/Bom_Retiro-bsfjbazzzuwmuidqurdmjvdtnnsb/Build/Products
And then for me is resolved opening the project usinf .xcworkspace file.
For those still having issues after all this.
I am working on a cordova project and the issue suddenly appeared after upgrading to XCode 11.5.
Finally I was able to solve it by opening the pods.json file in the project root and remove the entry in "libraries" which belongs to "FirebaseMessaging".
We were not using that and I dont know how it got there.
Additionally I have changed the "Build Setting" -> "Build Active Architecture Only" to "No" everywhere.
Afterwards I opened the .xcworkspace file again and the build ran through.
Worked solution is
Search GoogleToolboxForMa in xcodeproj
Remove all references from the build configurations
Swift 5 Simple Answer
Shift+Alt+Cmd+K //Clean the project and Run again!
//if not work restart Xcode and again clean it
//Its will work happy coding
Friends, you must be confused with the exact result, as i was. So, i feel to share the
screenshot that might be helpful. We all had to be careful that we need to change the flag for property **"Build Active architecture Only"** for **pod target** to **NO** And build, it would not show the linking error.
See the attached screenshot.
Screen Shot 1, Screen Shot 2, Screen Shot 3
[Select Pods][1]
[Select Targets in the pod][2]
[Change flag to No][3]
[1]: https://i.stack.imgur.com/E7mjX.png
[2]: https://i.stack.imgur.com/wCwET.png
[3]: https://i.stack.imgur.com/KVGKM.png

iOS: Cocoa Pods: Code Compile Issue

The Problem
I recently started working on a project.
Which Uses Cocoa Pods as the dependency manager.
It also uses Crashlytics for crash reporting.
Image Magick for Icon generation and Synx for reorganizing the project folder.
I was given Git access.
So I cloned the repo.
did a pod install
and compiled the code but it started giving me following error.
Project target is iOS 7.
Cocoa Pods Version is 0.36.4 also tried Latest 0.38.2
It is an iphone only app.
What I have done So far trying to solve this issue
So I sat down with the Original developer who was very helpful and had a working copy of the code on his machine. As it was a code handover so he was helping me setting it up on my machine.
We have tried all the usual suspects.
Clean and Build
Clean Quit Xcode Reopen and build
Quit xcode delete the Pods Directory and do a pod install
pod setup
pod update
Checked PODS_ROOT paths for different build configurations with working copy on another machine where it compiles correctly
My pods were latest so I uninstalled cocoapods using sudo gem uninstall cocoapods and installed the version the original developer had sudo gem install cocoapods -v 0.36.4
Matching Xcode versions xcode 6.4
Checking Configurations under Info in Project
Another pull from Github at a different location and doing all above steps.
Clear Xcode derived data folder.
So basically we checked all this retried all the above steps many times and also verified project settings build phases etc.
code is running fine on his machine.
Some weird behaviour i noticed was that one time instead of above mentioned error in picture it gave the famouse xyz.h file not found error for one of the libraries in Pods. But doing a pod install reverted back to original error.
Any ideas?
I remember this one.. I think it is due to cocopods changed the directory of there "copy pods resources" shell script from one version to the other. Look under your targets build phases and check for a "run script" entry i think. Look at the path and then check in finder to see where the shell script is really located.
Not really certain of the details... it might have been one of the other cocopods enters in the build phase section. Look around there, I do remember it was pretty easy to spot when you know where to look.
Should probably be the "Check Pods Manifest.lock" section under Build Phases.
Make sure you are opening workspace project(.xcworkspace) instead of XCode Project..
Else
Remove podfile.lock
Remove Pods Folder
Remove .xcworkspace
Remove manifest.lock (if exists)
Go to path of pod file and Run pod install
Then it will generate .xcworkspace.
Now onwards you need to use workspace instead of xcodeproj
Hope it helps you..!

dyld: Library not loaded with cocoapods 0.37 and Xcode 6.3

I've been reading all the issues about the error:
dyld: Library not loaded: #rpath/Bolts.framework/Bolts
Referenced from: /private/var/mobile/Containers/Bundle/Application/1542F906-CCE1-4181-AC7C-B5E3EE50E7D7/eBikeMotion.app/eBikeMotion
Reason: no suitable image found. Did find:
Which makes my application unable to run in a real device (but it runs without any problem in the simulator.
Until certain point I thought that it was an issue with the frameworks I was installing, but after installing manually the original one that was throwing the error, Alamofire, and the next Framework throwing the error was the next one in alphabetical order (Bolts, as you can see in the code snippet)
So I've reached the conclusion that is indeed CocoaPods which is producing these errors. I've got the last version (0.37) with a clean install, Iv'e tried to create a new project, I've tried all the proposed solutions to this issue without any luck, so I have to open an issue, with the hope that someone can help me.
Regards.
After reinstalling the whole system and don't finding a solution, I've found that some of the Build Phases mandatory for CocoaPods to run properly were missing.
The solution for this problem goes for the next steps:
Deintegrate the cocoapods project (you can install the tool with sudo gem install cocoapods-deintegrate).
cocoapods-deintegrate on Github
Modify your Podfile:
You should define your target linking with link_with 'ProjectName'.
You should define the target for your pods: target 'ProjectName' do [pods here] end.
Make an install with pod install
After doing this, go to XCode and check the following settings:
Into project settings, under "Configurations" check that in Debug and Release you've got a Configuration set named Pods-ProjectName.[debug|release]
Into your target, under "Build Phases" you should have three new phases that should be named: Check Pods Manifest, Embed Pods Frameworks and Copy Pods Resources.
Make a clean, then build, then run into your device.
That's it.
In my case, I followed the above answer by #Jorge, but it didn't resolve the problem. The exact error was a bit different because the missing file was #rpath Pods.framework/Pods. I finally resolved it with help from CocoaPods issue #3586:
Go to target > General > Linked Frameworks and Libraries section
set both Pods.framework and Pods_target.framework to Optional.
Still trying to figure out exactly why.... this answer has some info: what-does-it-mean-to-weak-link-a-framework
I had to fix two issues:
Go to each target then Build Phases then Link Binary With Libraries and select Pods.framework. Set it to Optional.
Cocoapods did not create the needed run scripts for my second target. My first target had all scripts. The second not. So I copied all missing run scripts from the first to the second target. You need to tap on the small "+" sign on the top left, add a run script and paste the script from the other target. I've done that for Check Pods Manifest.lock, Copy Pods Resources and Embed Pods Frameworks.
Then it did run on the device. Finally.
Had same issue adding pods to WatchKit Extension. Linking main target with Watch app is not the best option at all. Found out that cocoapod 0.37.2 hasn't added 'Embed Pods Frameworks' script into build phase.
Script:
"${SRCROOT}/Pods/Target Support Files/Pods-ExtensionName/Pods-ExtensionName-frameworks.sh"
In order to have cocoapods generate the build phases Check Pods Manifest, Embed Pods Frameworks and Copy Pods Resources:
1 - Go to build phases and remove any custom modifications. I had to remove everything under the Link Binary With Libraries phase.
2 - Do a pod deintegrate (Or just remove the files yourself)
3 - Run a new pod install
This worked for me. Without the first step, it never did.
To Resolve this you need to change status in Link Binary with Libraries in build phase for pod_projectName.framework and Bolt.framework
I got the same error in my project.
get error in CommonCrypto.framework
Resolved error by changing Required to Optional
The easiest thing to do would be to ensure that your Protobuf.framework is a dependency in your target's scheme inside the Build step.
This tells Xcode to compile the Protobuf.framework created by your pod install/update whenever it builds your target.

Resources