构建错误 Xcode 10 - 产生多个命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/52396637/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:46:41  来源:igfitidea点击:

Build error Xcode 10 - Multiple commands produce

iosswiftxcode

提问by Recusiwe

I just upgraded to Xcode 10, and I suddenly face this error when I try to build, any ideas how to fix it? I tried cleaning derived data, but without any luck.

我刚刚升级到 Xcode 10,当我尝试构建时突然遇到这个错误,有什么解决方法吗?我尝试清理派生数据,但没有任何运气。

enter image description here

在此处输入图片说明

回答by leaveslife

If you use CocoaPods, click Xcode menu file-> Workspace Settings, And click Build systemchoice Legacy Build System

如果你使用 CocoaPods,点击 Xcode 菜单file-> Workspace Settings,然后点击Build system选择Legacy Build System

https://i.stack.imgur.com/FqiID.png

https://i.stack.imgur.com/FqiID.png

If you not use CocoaPods, same of top , select Project Settings

如果你不使用 CocoaPods,与 top 相同,选择 Project Settings

回答by Vadim Piatkovskyi

You can try to change the build system to Legacy, File > Workspace Settings > Build System > Legacy Build System.

您可以尝试将构建系统更改为 Legacy,File > Workspace Settings > Build System > Legacy Build System。

回答by Abuzar Amin

If your app is generating the error related to the multiple .appfiles just like mentioned above in question then removing the .plistfiles from "Copy bundle Resources" WILL NOT WORK.

如果您的应用程序生成与上述多个.app文件相关的错误,那么.plist从“复制捆绑资源”中删除文件将不起作用。

If the error is related to .app file then follow the following steps.

如果错误与 .app 文件有关,请按照以下步骤操作。

  1. Select the Target.

  2. Go to Build Phasestab.

  3. Remove the items listed in Output Files
  4. Compile the code if it compiles successfully then not follow the next steps.
  5. If code does not compile successfully and Xcode may give you an error related to "Library not found". Then add the missing library in GeneralTab in Linked Frameworks and Librariesthat Xcode mentioned in the error.
  6. Keep adding these libraries (that Xcode ask through compile errors) in Linked Frameworks and Librariesuntil the code compiles successfully.

    Hope this helps.

  1. 选择目标。

  2. 转到Build Phases选项卡。

  3. 删除中列出的项目 Output Files
  4. 如果代码编译成功,则编译代码,然后不执行后续步骤。
  5. 如果代码没有成功编译,Xcode 可能会给你一个与“Library not found”相关的错误。然后在错误中提到的那个Xcode的GeneralTab中添加缺少的库Linked Frameworks and Libraries
  6. 继续添加这些库(Xcode 通过编译错误询问),Linked Frameworks and Libraries直到代码编译成功。

    希望这可以帮助。

回答by Bilal

I also faced this issue in xcode 10 but it was because of adding the same framework in main project + other extensions (watchkit or siri extension etc). I added ObjectMapperin podfilefor my main project + for my extensions. When I compiled it gave me an error that multiple command produceand also shows me which framework is causing this issue. Now its working fine for me as I've removed it from my extensions I wasn't using it in my extensions.

我在 xcode 10 中也遇到过这个问题,但这是因为在主项目 + 其他扩展(watchkit 或 siri 扩展等)中添加了相同的框架。我说ObjectMapperpodfile为我扩展我的主要项目+。当我编译它时,它给了我一个错误,multiple command produce并告诉我是哪个框架导致了这个问题。现在它对我来说很好用,因为我已经从我的扩展程序中删除了它我没有在我的扩展程序中使用它。

Don't know about your issue may be you can check your podfile.

不知道您的问题可能是您可以检查您的 podfile。

回答by Michael Gregory Gonalves Davis

i encountered this issue as well while working with CoreData.

我在使用 CoreData 时也遇到了这个问题。

in my .xcdatamodeld file, it came down to the fact that, during the creation of my various Entities, i had copy and pasted one multiple times (thinking i was saving time because various properties were similar enough that i thought this was a good idea).

在我的 .xcdatamodeld 文件中,归结为这样一个事实,即在创建各种实体的过程中,我多次复制并粘贴了一个实体(认为我是在节省时间,因为各种属性足够相似,所以我认为这是一个好主意) )。

the resulting Build error Xcode 10 - 'Multiple commands produce' occurred because i forgot to check and make sure the new Entities were set to their own unique corresponding class to match the new Entity in the Data Model Inspector pane.

由于我忘记检查并确保将新实体设置为它们自己唯一的对应类,以匹配数据模型检查器窗格中的新实体,因此发生了生成错误 Xcode 10 - '多个命令生成'。

unfortunately, it took me two days to figure out the original Entity's Class Name was still in place.

不幸的是,我花了两天时间才弄清楚原来实体的类名仍然存在。

so lesson: careful when you copy/paste/duplicate Entities in CoreData. (... i guess :0} )

所以教训:在 CoreData 中复制/粘贴/复制实体时要小心。(...我猜:0})

some time saver. oops! hope this helps someone.

节省一些时间。哎呀!希望这有助于某人。