I tried the solution suggested by Maxwell above but it didn’t resolve the problem for me.
The error appeared with Xcode 12 but upgrading to Xcode 13 didn’t fix it either.
Instead, I decided to take Xcode at its word and delete the Package.resolved file. But where is it? I did this:
-
In Finder, tap Shift+Cmd+. to reveal hidden files and folders.
-
The Package.resolved file is inside your .xcodeproj directory at [appName].xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
-
Right click on .xcodeproj and project.xcworkspace to show package contents.
-
Move the Package.resolved file to the bin, and then empty the bin.
-
Reopen Xcode and open your project again. This gave me another error:
the package at “https://stackoverflow.com/” cannot be accessed (Couldn’t read ‘4.5.0’: -
In Xcode, File / Packages / Reset package caches.
The Swift Package Manager starts working on this. -
Rebuild the project. The error had gone and my project rebuilt successfully.