Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle a Swift Package's dependent artifact checksum?

Using Xcode 12 beta and swift-tools-version 5.3, you can link to a framework, like this:

        .binaryTarget(
            name: "Stripe",
            url: "https://github.com/stripe/stripe-ios/releases/download/v19.3.0/Stripe.xcframework.zip",
            checksum: "fe459dd443beee5140018388fd6933e09b8787d5b473ec9c2234d75ff0d968bd"
        )

But when I needed to update the checksum (I had it wrong) I get

: artifact of binary target 'Stripe' has changed checksum; this is a potential security risk so the new artifact won't be downloaded

How can I reset this, or override it when I need to change the checksum?

like image 404
Marty Avatar asked Jul 06 '20 17:07

Marty


People also ask

How do I distribute XCFramework?

To distribute code in binary form as a Swift package, create an XCFramework bundle, or artifact, that contains the binaries. Then, make the bundle available locally or on a server: When you host the binaries on a server, create a ZIP archive with the XCFramework in its root directory and make it available publicly.

How do I archive a Swift package?

Swift package source archives are Zip files. You can generate a source archive by running swift package archive in the root directory of a package. SYNOPSIS swift package archive [--output=<file>] OPTIONS -o <file>, --output=<file> Write the archive to <file>. If unspecified, the package is written to `\(PackageName).

How do I update Swift package dependencies?

To resolve, Open the project from the project panel, select the project (not the targets), then select the "Swift Packages" tab. Double click on the package you want to update and change the minimum version to the next major version.

Where are Swift package dependencies stored?

In order to cache the dependencies, they should be located in the project directory, but by default, SPM downloads the dependencies into the system folder: ~/Library/Developer/Xcode/DerivedData.


1 Answers

In order to get rid of the error, you need to purge Xcode's local package caches.

In Xcode's File menu, select 'Swift Packages' and then 'Reset Package Caches'

like image 98
Morten Bek Ditlevsen Avatar answered Oct 12 '22 06:10

Morten Bek Ditlevsen