Xcode 12 SPM: "target [...] referenced in product [...] could not be found"

In Xcode 12, I'm trying to add a package dependency to an Xcode project. Specifically, this is the swift-bson package from mongoDB.

When adding the dependency to the project using File -> Swift Packages -> Add Package Dependency, I can find the git repository just fine. But when I try to add it, I get an error with the following messages:

[Complete] Fetching https://github.com/mongodb/swift-bson.git 0.6 seconds
[Error] target 'bson' referenced in product 'bson' could not be found

I'm new to packages so I might be misunderstanding how this feature is supposed to work, but I'm pretty sure this is what the docs say I should do. This might also be an Xcode 12 thing, I know they changed a couple of things related to packages.

Tried:
  • Creating my own package and adding this one as a dependency

  • Switching project targets

  • Adding to a specific target instead of the whole project

  • Getting a different version of the package

Can someone help shed some light on what might be wrong?
Answered by crichez in 686268022

Turns out that package doesn't support iOS, so wasn't building.

Accepted Answer

Turns out that package doesn't support iOS, so wasn't building.

Xcode 12 SPM: "target [...] referenced in product [...] could not be found"
 
 
Q