Handle CryptoKit archiving error

In some case, during the creation of your application Archive, you can have this error:

No such module ‘CryptoKit’

This case can append when you are trying to target an old iOS version < iOS13.

Even if you are checking iOS 13 availability like #available(iOS 13, *) or @available(iOS 13, *), you can’t compile your application.

A simple solution is to use pre compilation operator, like #if canImport. With this operator, you can exclude CryptoKit from your application if it’s not available:

You have also to wrap your CryptoKit usage in order to prevent any issue during archiving, for example:

With this syntax, you can generate your archive, even if your device target does not have CryptoKit available

--

--

Android & iOS, quality in software is 𝛼&ɷ

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store