I tried out the CoreML Model Encryption feature that comes with Xcode 12.
I generated the key - https://developer.apple.com/documentation/coreml/core_ml_api/generating_a_model_encryption_key and added the --encrypt compiler flag - https://developer.apple.com/documentation/coreml/core_ml_api/encrypting_a_model_in_your_app as described in the docs.
Everything works on iOS 14. However on an iOS 13 simulator I get a runtime error saying
MLModelAsset: load failed with error Error Domain=com.apple.CoreML Code=3 "No known class for loading model type INVALID" UserInfo={NSLocalizedDescription=No known class for loading model type INVALID}
So iOS 13 can't handle the encrypted model and says it's invalid, which makes sense I guess. But how are we supposed to maintain backwards-compatibility to iOS 13?
(As expected the error goes away if I remove the --encrypt compiler flag again.)
I want to add that I did NOT use the new async API - https://developer.apple.com/documentation/coreml/mlmodel/3600218-load to load the model, but instead the automatically generated wrapper class from my local model and it's init method.