How can I get checksum for a Binary Package?

Viewed 872

I created my xcframework on my Desktop called MyXCFramework.xcframework then I zipped it like Boris said in WWDC2020 about Distribute binary frameworks as Swift packages both files are on Desktop and I want to get my checksum, then I used this line of code in terminal:

cd ~/Desktop/

swift package compute-checksum ~/Desktop/MyXCFramework.xcframework.zip

But terminal through this error:

error: root manifest not found

How can I solve this error?

I do not know why terminal trying to reach to manifest in this point?! because there is no manifest yet! I need checksum to build my manifest for Distribute binary framework as Swift package. So How can I solve this issue?

1 Answers

After searching a lot and lots of try and errors I found 2 ways to solve the issue:

First way from Apple

To create the required checksum, open the Terminal app, navigate to the root of the package, and run swift package compute-checksum path/to/MyFramework.zip.

Way 1:

1 - It is important to mention that Apple said MyFramework.zip but in the fact it is MyXCFramework.zip

2 - Apple said: navigate to the root of the package it means the package that you are going to type and gave checksum to it! it is wired why the Folder or the Package needed for reading checksum? because checksum is the parameter for Package! I do not know what is happening under hood but it is how it works!

Way 2:

You can gave some dummy value as checksum to Package, then Xcode would through an error and says you the correct and needed checksum and also says you which wrong checksum you used! then you copy that error massage and strike the correct checksum and replace it instead of the dummy checksum. we are not done it! because Xcode would be not build or correct the Package for new and correct checksum it would be in kind of lockdown! you need to go to File in Xcode then Swift Package then click on Reset Package Cashes. After that you are good to go! In this way you shortcut the Terminal way for reading checksum.

Here you are 2 way of finding checksum!

Related