I have recently faced a strange problem in the iOS application we develop. It turned out we were not able to build the app in test configuration for running unit tests in one of our two production schemes. Xcodebuild was complaining about linking the storyboard, Image.xcassets, localization files and one of the resource bundles. The first three errors didn’t contain any meaningful descriptions, but the fourth one was telling that it cannot copy the bundle as the target directory is not empty. I googled this error, but didn’t find any quick fixes that would work. So I started to dig in.