简体   繁体   中英

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

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:

  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

通过将 Cocoapods 从 1.4.0 更新到 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:

  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.

在“共享工作区设置”中将“构建系统”设置为“传统构建系统”,您可以在“文件 --> 工作区设置”中找到该设置

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.

关键是做pod deintegraterm *.workspace文件!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM