I tried out the CoreML Model Encryption feature that comes with Xcode 12.
I generated the key and added the --encrypt compiler flag as described in the docs.
Everything works on iOS 14. However on an iOS 13 simulator I get a runtime error saying
(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 to load the model, but instead the automatically generated wrapper class from my local model and it's init method.
I generated the key and added the --encrypt compiler flag as described in the docs.
Everything works on iOS 14. However on an iOS 13 simulator I get a runtime error saying
Code Block 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 to load the model, but instead the automatically generated wrapper class from my local model and it's init method.