Cannot import CryptoKit if minimum deployment target is less than iOS11

Originator:serieuxchat
Number:rdar://7495817 Date Originated:December 18, 2019
Status:Open Resolved:
Product:Xcode Product Version:11.3 (11C29)
Classification:Incorrect/Unexpected Behavior Reproducible:Always
 
We are developing an app targeting iOS10.3 as the minimum deployment target.

On devices running iOS13 and higher we would like to make use of CryptoKit framework.

For that purpose we put all of the code that makes use of CryptoKit behind if #available(iOS 13.0, *) { … }

However, if we build our app for Release, CryptoKit module cannot be found. In Debug configuration all works fine.

Steps to Reproduce:

 Open the attached sample project.
- From the Xcode menu choose Product -> Build For -> Profiling (to make it build for Release).
- Observe the error “No such module 'CryptoKit’”
- Change the minimum deployment target to iOS11 (under General tab for the TestCryptoKit target)
- From the Xcode menu choose Product -> Build For -> Profiling (to make it build for Release).
- Observe that there are no more errors about missing module.

I tried explicitly setting Swift import paths or copying the framework elsewhere, all to no avail. Apparently, Xcode explicitly forbids importing the module for some reason.

What did you expect to happen:

I expected the behavior to be the same for IOS10.3 and iOS11 minimum deployment targets.

If the minimum deployment target was iOS10.3, compilation did NOT succeed, and the error “No such module 'CryptoKit’” was shown.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!