This target might include its own product

Select the target in your Xcode project and click the Build Phases tab. Look at the Target Dependencies list; the target's product should not be listed there, but it sounds like it may have been added to that list by mistake. Also check the other areas in that same tab -- you don't want your product listed in Copy Bundle Resources or Link Binary With Libraries, either -- you obviously can't use the thing that you're building as a resource or library to build the product in the first place. That's what Xcode seems to be complaining about.


Ran across this issue using Xcode 7 (beta 1) when trying to build a Static Library target. Here was the error message from the build output:

Unable to run command 'CopySwiftLibs libMyStaticLibraryName.a' - this target might include its own product.

(I substituted libMyStaticLibraryName.a above in place of the actual name of my static library.)

The problem turned out to be that this static library target had the Embedded Content Contains Swift Code build setting (EMBEDDED_CONTENT_CONTAINS_SWIFT) set to YES, when in reality there was no Swift code associated with this target. Setting this to NO in Xcode fixed the issue.

Static libraries cannot include Swift code, so if this build setting is set it causes the error, even if there is no actual Swift code in the target.

Tags:

Iphone

Xcode

Ipad