Xcode Cloud: Could not resolve package dependancies.

I'm getting the same error on my apps:

Resolve Package Graph
xcodebuild: error: Could not resolve package dependencies:

  a resolved file is required when automatic dependency resolution is disabled and should be placed at /Volumes/workspace/repository/Opus One.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

  fatalError

I have the Lottie as a Swift Package, but the Xcode cloud docs say that it should be automatic since its public. So, I'm looking for any possible hints as to what to look for or how to debug this issue.

Thank you.

Accepted Reply

It may also be helpful to have a look at this page in the Swift Package Manager documentation: https://developer.apple.com/documentation/swift_packages/building_swift_packages_or_apps_that_use_them_in_continuous_integration_workflows

In particular the section: 'Use the Expected Version of a Package Dependency'

To ensure the CI workflow’s reliability, make sure it uses the appropriate version of package dependencies. Xcode stores the exact version of each package dependency in a file called Package.resolved. The file automatically updates when package requirements in your Xcode project or in the Package.swift manifest file change. Commit this file to your Git repository to ensure it’s always up-to-date on the CI environment to prevent the CI from building your project with unexpected versions of package dependencies.

Tip You can find the Package.resolved file inside your .xcodeproj directory at [appName].xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved.

If your CI pipeline uses the xcodebuild command directly, also pass the -disableAutomaticPackageResolution flag. This flag ensures that the CI pipeline always uses the package dependencies as defined in the Package.resolved file.

Replies

Did you check in the Package.resolved file as suggested in the error message?

I was confused about the location of the file and as to its purpose, as I thought It had something to do with the external swift package I use. This file is located inside the project file container and then inside the workspace file container. The gitignore file that I'm using was preventing this file to be added to the repo, I had to comment out a bunch of files related to the project and workspace before it got added to the repo. Once I did, the workflow built just fine. Thanks !

It may also be helpful to have a look at this page in the Swift Package Manager documentation: https://developer.apple.com/documentation/swift_packages/building_swift_packages_or_apps_that_use_them_in_continuous_integration_workflows

In particular the section: 'Use the Expected Version of a Package Dependency'

To ensure the CI workflow’s reliability, make sure it uses the appropriate version of package dependencies. Xcode stores the exact version of each package dependency in a file called Package.resolved. The file automatically updates when package requirements in your Xcode project or in the Package.swift manifest file change. Commit this file to your Git repository to ensure it’s always up-to-date on the CI environment to prevent the CI from building your project with unexpected versions of package dependencies.

Tip You can find the Package.resolved file inside your .xcodeproj directory at [appName].xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved.

If your CI pipeline uses the xcodebuild command directly, also pass the -disableAutomaticPackageResolution flag. This flag ensures that the CI pipeline always uses the package dependencies as defined in the Package.resolved file.