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条回答
放我归山
2楼-- · 2019-01-07 02:20

Swift 3: (but also the older versions) it happen when I have assets with duplicates. Just rename the files with this issue and all go well.

It could happen also when you have made a Assets.xcassets and you have renamed the duplicates with new names so after time you forgot it and remove it to add the folder references but this one return to the duplicate files problem..

查看更多
叼着烟拽天下
3楼-- · 2019-01-07 02:21

I'm pretty sure this can be caused by an XCode 4 bug, at least in the cases that I've encountered it in.

It happens if you add multiple language dependent files to the project at the same time. I found this out by looking through the git differences. I did nothing in the commit but add some new localized nib files. But looking back at the difference of the project.pbxproj file it showed a bunch of new duplicate references added for files that were already in the project before. The files it did this too seemed random to me.

I reproduced this same exact behavior multiple times.

Deleting these files from the project does not fix the problem because it only deletes the original reference and leaves the duplicates. The only way to fix it is to go back a commit and start over, or hand edit the project file, which is a really good way to screw it up even more since it's hard to tell which duplicates to remove and you have to do it in a ton of different places.

Xcode 4 is just a huge disappointment for me.

查看更多
我命由我不由天
4楼-- · 2019-01-07 02:23

Actually The answer to this is very simple.

In your xcode search for the files which raises the warning, and just delete it.

The Xcode will show only one reference of that file in the search results, but dont stop there, go ahead and delete it. (better make a back up to your project file before delete operation)

Now do a build, you will see the warning removed. (this answer is for a previous version of xcode)

查看更多
我只想做你的唯一
5楼-- · 2019-01-07 02:23

This happens if you have 2 files with the same name in the project. Even though files are in groups in XCode when the project is compiled all of the files end up in the same directory. In other words if you have /group1/image.jpg and /group2/image.jpg the compiled project will only have one of the two image.jpg files.

查看更多
贪生不怕死
6楼-- · 2019-01-07 02:25

I had the same problem minutes ago. I've mentioned changing the 'deployment target' fixed my problem.

查看更多
迷人小祖宗
7楼-- · 2019-01-07 02:27

What worked for me:

  1. Drag repo to the trash.
  2. re-clone your repo.
  3. set up your repo with correct remote tracking. git remote add <url.git>, or git remote set-url <url.git>

This absolutely worked for me. In my case for some elusive reason, when I ran git pull upstream develop for a local dependency, git would pull in/generate duplicate files from multiple commits.

After following the above steps, the issue went away and git pull upstream develop was no longer pulling from multiple commits at once. Perhaps there was a weird git cache for my repo.

查看更多
登录 后发表回答