xcodeswift-package-managerswift-packagexcode-cloud

Xcode Cloud Errors Building Local SPMs that Work Locally "an out-of-date resolved file was detected"


Have added 2 Swift packages locally. (GraphQL code gens for Swift using Apollo iOS SDK v1.9.0). I'm using Xcode to manage the Swift packages. They've been added to the Project > Package Dependancies as well as linked in the Targets > Build Phases > Linked Binaries With Libraries. For both our target.

Everything works correctly when building locally but when I try to build on Xcode Cloud we get these errors:

Could not resolve package dependencies: an out-of-date resolved file was detected at /Volumes/workspace/repository/Play.xcworkspace/xcshareddata/swiftpm/Package.resolved, which is not allowed when automatic dependency resolution is disabled; please make sure to update the file to reflect the changes in dependencies. Running resolver because the following dependencies were added: 'myPackage' (/Volumes/workspace/repository/MyProject/MyPackage) fatalError

an out-of-date resolved file was detected at /Volumes/workspace/repository/MyProject.xcworkspace/xcshareddata/swiftpm/Package.resolved, which is not allowed when automatic dependency resolution is disabled; please make sure to update the file to reflect the changes in dependencies. Running resolver because the following dependencies were added: 'myPackage' (/Volumes/workspace/repository/MyProject/MyPackage)fatalError2024-02-28 12:07:52.786 xcodebuild[4161:18697] Writing error result bundle to /var/folders/pc/xhyhfmrd1mq975kcng4w278r0000gn/T/ResultBundle_2024-28-02_12-07-0052.xcresult

I've removed the Package.resolved from git ignore, but it still happens. I've tried every option to "resolve package versions" and update the package versions.

Any help appreciated. Thanks!


Solution

  • Make sure the version of Xcode you're using locally matches the one you're building with in Xcode Cloud. We had an issue like this and realized that it was due to running Xcode 13.3 locally but using 13.2 to build in the cloud.