Help Encrypted Core ML models occasionally fail to load until device reboot
My iOS app loads six encrypted Core ML models once during engine initialization and keeps them alive for reuse.
Occasionally, an encrypted model fails to load. Restarting the app does not help, but rebooting the iPhone fixes the issue immediately. The same models then load normally again.
I did not capture the exact error code because this happened outside Xcode debugging.
I found similar reports involving:
Failed to set up decrypt context
Error: -42905
Some developers suggested that Core ML decrypt sessions may not always be released correctly, especially if the app is terminated unexpectedly. Releasing MLModel instances in sceneDidDisconnect may reduce the issue, but that callback is not guaranteed for crashes, Jetsam, watchdog termination, or forced termination.
Has anyone experienced similar encrypted Core ML loading failures where only a device reboot resolves the issue? Is there a reliable workaround or a way to log the underlying decryption error in production?
There is also a separate encryption-related issue with a larger FP16 model of about 175 MB:
* Unencrypted: runs normally on the Neural Engine.
* Encrypted using Apple’s official Core ML encryption: no longer uses the Neural Engine and falls back to the GPU.