Xcode warning: “Multiple build commands for output file”

前端 未结 23 1691
既然无缘
既然无缘 2020-11-28 17:29

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

<
23条回答
  •  北海茫月
    2020-11-28 18:02

    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.

提交回复
热议问题