Accepted answer

"Package.resolved file is corrupted or malformed ios build error-Ionic & iOS"

Found the issue,  installed Firebase with the Swift package manager and that seemed to cause issues so I removed the package and added it via CocoaPods

Accepted answer

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:

  1. In Finder, tap Shift+Cmd+. to reveal hidden files and folders.

  2. The Package.resolved file is inside your .xcodeproj directory at [appName].xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

  3. Right click on .xcodeproj and project.xcworkspace to show package contents.

  4. Move the Package.resolved file to the bin, and then empty the bin.

  5. Reopen Xcode and open your project again. This gave me another error: the package at '/' cannot be accessed (Couldn’t read '4.5.0':

  6. In Xcode, File / Packages / Reset package caches. The Swift Package Manager starts working on this.

  7. Rebuild the project. The error had gone and my project rebuilt successfully.

using CocoaPods and SwiftPackageManager in a project together there are two Package.resolved files. One is in YourProj.xcworkspace and the other is in YourProj.xcproj -> project.xcworkspace. I had to delete both and then it worked again.

 Package.resolved file is need delete the disable package and Package.resolved.

you could not find the Package.resolved in Finder,you should select it in the project.the detail as follow:

  1. open the .xcodeproj or .xcworkspace right click to show the content
  2. right click to show content of the project.xcworkspace
  3. open The xcshareddata/swiftpm,you should find the Package.resolved
  4. delete the file then re-add the package

it worked for me:

Kill xcode

Then completely remove the derived data directory (empty trash just to be absolutely sure).

Restart Xcode

Reset Swift package cache