ios Xcode 10 错误:为“app”和“appex”生成多个命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/52382667/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode 10 Error: Multiple commands produce for 'app' and 'appex'
提问by Norbert
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).
我得到了最近讨论的“Xcode 10 错误:多个命令产生...”错误,但对于我项目的结果应用程序和 appex 文件。有谁知道这是什么意思。我的项目有一个应用程序和两个扩展程序(只有一个是错误的一部分)。
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.
我知道我可以回到旧的构建系统,但我更喜欢使用新的和更快的构建系统。感谢您的任何帮助。
采纳答案by Norbert
Solved my problem by updating Cocoapods from 1.4.0 to 1.5.3
通过将 Cocoapods 从 1.4.0 更新到 1.5.3 解决了我的问题
回答by zasia
In case someone is still struggling with this after updating cocoapods and reinstalling pods:
如果有人在更新 cocoapods 并重新安装 pod 后仍然在为此苦苦挣扎:
- 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
- 目标的开放构建阶段会给你带来问题
- 打开复制 Pod 资源阶段。
- 确保输出文件为空。就我而言,我有一个奇怪的条目
${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}
。我删除了它并且构建成功
回答by user3877214
回答by hardik parmar
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.
我的 Cocoapod 版本已经是 1.5.3(最新)了。只需运行“pod install”(或“pod install --no-repo-update”,如果你不想更新现有的pods)就为我解决了这个问题。
回答by moonToBy
set "Build System" to "Legacy Build System" in "Shared Workspace Settings" which you can find in "File --> Workspace Settings"
在“共享工作区设置”中将“构建系统”设置为“传统构建系统”,您可以在“文件 --> 工作区设置”中找到该设置
回答by christijk
My workaround:
我的解决方法:
Check your pod version
pod --version
. Update Coacoapods to latest version - v1.5.3 if it's not, by runningsudo gem install cocoapods
Update all your pods by running
pod update
Remove duplicate
info.plist
file fromTarget>Build Phases>Copy Bundle Resources
if any.
检查您的 pod 版本
pod --version
。将 Coacoapods 更新到最新版本 - 如果不是 v1.5.3,请运行sudo gem install cocoapods
通过运行更新所有 Pod
pod update
如果有的话,删除重复的
info.plist
文件Target>Build Phases>Copy Bundle Resources
。
回答by Ofcourse
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.
- 更新 Cocoapods
- 删除 pod 文件(不要忘记将内容复制到其他地方,以便您可以恢复它)
- 删除工作区项目文件
- 删除锁舱文件
- 删除pod目录
- 关闭 Xcode
- 初始化 pod
- 安装吊舱
- 打开工作区项目。
回答by Yauheni Liauchuk
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.
导致“多个命令产生”错误的可能问题之一可能是具有冲突模块名称的多个目标。在我的例子中,我有一个主应用程序目标和一个通知服务扩展目标具有相同的Product Module Name,所以 Xcode 试图创建两个 ModuleName.swiftmodule 文件,两个 ModuleName.swiftdoc 文件等。更改通知服务扩展模块名称修复了问题.
回答by Renetik
The key was to do pod deintegrate
and rm *.workspace
file !
关键是做pod deintegrate
和rm *.workspace
归档!
回答by Tieme
You might have ran into this CocoaPods issuewhich is caused by this Xcode issue
您可能遇到了由这个Xcode 问题引起的CocoaPods问题
This replymight help you, it suggest to specify the subspecs explicitly in your Podfile.
此回复可能对您有所帮助,它建议在您的 Podfile 中明确指定子规范。
For example use pod 'SDWebImage/Core'
instead of pod 'SDWebImage'
例如使用pod 'SDWebImage/Core'
代替pod 'SDWebImage'
Apparently, this causes the build product path to always contain the subspec name which might fix the issue.
显然,这会导致构建产品路径始终包含可能解决问题的子规范名称。