Bundle encrypted CoreML model within a third-party framework

I'm working on an iOS framework that will be integrated into customer applications and I've added some ML functionality for the host apps to use. My framework is open source and licensed to my customers, therefore I would like to bundle the CoreML model as an encrypted and compiled asset within the framework. According to this WWDC video, it seems like it should be possible: https://developer.apple.com/videos/play/wwdc2020/10152/

I've made a quick test app, compiled and encrypted the model and added it to the "Copy Files Build Phase" of my Framework. However upon calling the load method of my model class, I receive the following error:

Error Domain=com.apple.CoreML Code=3 "failed to invoke mremap_encrypted with result = -1

I've checked the package contents of my test app, and I see within it my Framework.bundle (with _CodeSignature) is there and within that I see my Model.mlmodelc file. Everything seems to be in place and signed correctly.

The video states that model decryption keys are associated with a Developer Team and are automatically downloaded when needed. How is this done exactly? Do the keys need to belong to the team of the running application or can they belong to the Team of a framework developer?

Any help would be much appreciated. Thanks.

Hi, unfortunately, this use case is not supported. Model has to be encrypted with a key that was generated with the same development team as the one that signed the app that is running on the device. Please file a feature request on http://feedbackassistant.apple.com/ for this and we can look into this.

Bundle encrypted CoreML model within a third-party framework
 
 
Q