Xcode warning: “Multiple build commands for output

2019-01-07 01:56发布

I am getting an error like this:

[WARN]Warning: Multiple build commands for output file /Developer/B/Be/build/Release-iphonesimulator/BB.app/no.png

[WARN]Warning: Multiple build commands for output file /Developer/B/Be/build/Release-iphonesimulator/BB.app/d.png

[WARN]Warning: Multiple build commands for output file /Developer/B/Be/build/Release-iphonesimulator/BB.app/n.png

But I have checked Xcode and I don't see any duplicates of such files at all. As this post in the Apple Mailing Lists say, there are no duplicates.

20条回答
Luminary・发光体
2楼-- · 2019-01-07 02:13

The error seem to appear when u have more than one reference of the same file. I had 2 files of the same name and got this error. When I delete one of them the error disappear..

查看更多
再贱就再见
3楼-- · 2019-01-07 02:14

One of simple way is,

  • Go to App target
  • Go to Build Phases
  • Output files
  • Delete path of out put files, then build project. It will run successfully.
查看更多
兄弟一词,经得起流年.
4楼-- · 2019-01-07 02:17

I found a pretty easy solution for this:

  1. Select the file causing the problem from the project navigator
  2. Uncheck the target membership from the file inspector
  3. Build the project
  4. Recheck the target membership for the file again

The warning is gone! Check this image for reference.

enter image description here

查看更多
成全新的幸福
5楼-- · 2019-01-07 02:17

Open the Frameworks folder in your project and make sure there are only frameworks inside. I added by mistake the whole Developer folder!

查看更多
狗以群分
6楼-- · 2019-01-07 02:18

This is not an Xcode bug, though the warning message is not helpful enough to describe the real cause.

This error message occurs when you have several files in your project that have the same name. You just have to delete or rename the files with duplicate names and the problem is solved.

查看更多
够拽才男人
7楼-- · 2019-01-07 02:18

As previously mentioned, this issue can be seen if you have multiple files with the same name, but in different groups (yellow folders) in the project navigator. In my case, this was intentional as I had multiple subdirectories each with a "preview.jpg" that I wanted copying to the app bundle:

group references

In this situation, you need to ensure that Xcode recognises the directory reference (blue folder icon), not just the groups.

Remove the offending files and choose "Remove Reference" (so we don't delete them entirely):

remove group references


Re-add them to the project by dragging them back into the project navigator. In the dialog that appears, choose "Create folder references for any added folders":

add as folder references


Notice that the files now have a blue folder icon in the project navigator:

folder references


If you now look under the "Copy Bundle Resources" section of the target's build phases, you will notice that there is a single entry for the entire folder, rather than entries for each item contained within the directory. The compiler will not complain about multiple build commands for those files.

查看更多
登录 后发表回答