42

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.

Norbert
  • 1,204
  • 1
  • 9
  • 13
  • Please check this...[check](https://stackoverflow.com/questions/52364895/xcode-10-gm-multiple-command-produce-pods-issues/52366773#52366773) – Pratik Sodha Sep 18 '18 at 10:35
  • Thank you, but that does not help, I have Cocoapods installed. – Norbert Sep 18 '18 at 11:02
  • 6
    Check in `Project -> Build Phases -> Copy Bundle Resources` have file with same name. Just remove repetitive file. – Pratik Sodha Sep 18 '18 at 11:15
  • 3
    I found the solution: I missed to update Cocoapods from 1.4.0 to 1.5.3 - after having updated Cocoapods the problem disappeared. Thanks again, you gave me a hint in the right direction. – Norbert Sep 18 '18 at 11:38
  • Great.... :) (Y) – Pratik Sodha Sep 18 '18 at 11:39
  • @Norbert What command did you use to update the cocoa pods? – nr5 Sep 20 '18 at 08:00
  • @nr5 I used the command `sudo gem install cocoapods -n /usr/local/bin/`, but for most people `sudo gem install cocoapods` should be fine. – Norbert Sep 24 '18 at 09:06
  • Ya I tried it and couple of other steps but still stuck with this issue: https://stackoverflow.com/questions/52421408/xcode-10-multiple-commands-build-error-for-pods-dependency – nr5 Sep 24 '18 at 10:51
  • try this: https://stackoverflow.com/a/50719379/3024579 – Alok Nov 12 '18 at 09:47
  • 2
    Any solution for those not using CocoaPods? – johnborges May 06 '19 at 19:34
  • Check extension have same name with Project Target – Pablo Ruan Jul 20 '20 at 05:19
  • I had a similar problem but with GoogleMaps.bundle instead of My App.dev. Going to target > Build Phases >Copy Pods Resources and checking for install builds only worked. None of the other solutions here worked. For others who have a similar problem, this might be worth a try! – Aditya Yadavalli Jun 02 '21 at 17:15
  • @PratikSodha write this in an answer instead of comment. This is the solution actually. Thanks :) – Sanaullah Javeid Aug 01 '22 at 13:00

16 Answers16

50

In case someone is still struggling with this after updating cocoapods and reinstalling pods:

  1. Open Build Phases of the target which gives you problems
  2. Open Copy Pods Resources phase.
  3. 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
zasia
  • 641
  • 5
  • 5
32

Solved my problem by updating Cocoapods from 1.4.0 to 1.5.3

Norbert
  • 1,204
  • 1
  • 9
  • 13
  • Worked for me! I updated cocoapods and then did pod update in the project folder – Kamen Dobrev Sep 21 '18 at 12:47
  • Why haven't you accepted your own answer yet? Seems to work for most people running into this. ;) – Bocaxica Oct 15 '18 at 14:21
  • 1
    @Bocaxica just forgot about it. Thanks for your reminder. – Norbert Oct 16 '18 at 06:51
  • I did it but just this https://stackoverflow.com/a/52451421/2238515 solved for me – Almeida Nov 04 '18 at 22:03
  • This solved for me. A small note : before trying this solution, I tried another solution [https://stackoverflow.com/questions/48601206/error-unrecognized-font-family-material-design-icons-after-installing-react-nat](here) that required me to add the Fonts folder from node_modules/react-native-vector-icons to the "Copy Bundle Resources" on XCode. In this case, even after updating cocoapods, my build ws failing. When I removed these files from the Xcode Fonts folder, the build is successful. – Bhargav May 09 '22 at 22:43
28

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.

image shows where it's changed

user3877214
  • 311
  • 3
  • 7
  • 8
    That works, but I prefer using the new faster build system instead of the old lazier one. – Norbert Jan 08 '19 at 08:38
  • 2
    Is there any solution to get this to work with the new build system? – José May 06 '20 at 12:34
  • Update: this solution is no longer valid as of Xcode 13.2. Enabling the Legacy option results in the following error: `The Legacy Build System will be removed in a future release. You can configure the selected build system and this deprecation message in File > Workspace Settings.` – Mike S. Feb 03 '22 at 18:51
13

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.

hardik parmar
  • 853
  • 8
  • 15
9

My workaround:

  1. Check your pod version pod --version. Update Coacoapods to latest version - v1.5.3 if it's not, by running sudo gem install cocoapods

  2. Update all your pods by running pod update

  3. Remove duplicate info.plist file from Target>Build Phases>Copy Bundle Resources if any.

christijk
  • 1,753
  • 18
  • 26
8

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

moonToBy
  • 89
  • 1
  • 4
5

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.
Ofcourse
  • 617
  • 1
  • 7
  • 19
  • Thank you for your solution, I have tried all the above methods, your answer has solved my problem, thank you very much. – Bingerz Oct 18 '18 at 15:26
4

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.

Morten Holmgaard
  • 7,484
  • 8
  • 63
  • 85
1

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.

Tieme
  • 62,602
  • 20
  • 102
  • 156
1

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

Renetik
  • 5,887
  • 1
  • 47
  • 66
0

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

Mrug
  • 4,963
  • 2
  • 31
  • 53
0

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.

0

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

Muhammad Essa
  • 219
  • 2
  • 6
0

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)

Cameron Porter
  • 801
  • 6
  • 15
0

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

0

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

Pratik Sodha
  • 3,679
  • 2
  • 19
  • 38