Package can not be resolved in Xcode

ghz 8months ago ⋅ 73 views

Package.resolved file is corrupted or malformed; fix or delete the file to continue: unknown 'PinsStorage' version '3' at '.../project.xcworkspace/xcshareddata/swiftpm/Package.resolved'.

This happens after adding package https://github.com/socketio/socket.io-client-swift

We already did a clean build and deleted derived data but it is still not working.

Answers

This error suggests that there might be an issue with the version of the socket.io-client-swift package specified in your Package.resolved file. To resolve this issue, you can try the following steps:

  1. Delete the Package.resolved file:

    rm -rf /path/to/your/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
    
  2. Update the package dependencies:

    swift package update
    
  3. Rebuild your Xcode project:

    xcodebuild clean
    
  4. Reopen your Xcode project and try building again.

If the issue persists, it's possible that the package repository has been updated or there is a compatibility issue with your current Swift toolchain. In that case, you can try specifying a specific version of the package in your Package.swift file.

For example, you can specify the version in your Package.swift like this:

.package(url: "https://github.com/socketio/socket.io-client-swift", from: "15.0.0"),

Replace "15.0.0" with a specific version number or a version range that is compatible with your project.

After making the changes, repeat steps 2 to 4 to rebuild your project. If you're still facing issues, you might need to reach out to the package maintainers for further assistance.