Hi,
I have a question regarding reading the configuration of a managed app deployed via an MDM system. The application has an Action Extension and can receive shared files via this extension.
The problem I am facing is that I can read the managed configuration in the host app by accessing the UserDefaults.standard.object(forKey: "com.apple.configuration.managed")
dictionary. With this, I can configure the host app. However, I am unable to read this configuration key in the Action Extension part of the application.
My question is whether there is any possibility to read the managed configuration even in the extension. So far, I have been unable to figure out how to read it.
I found the sample code, but it was not very helpful since it is very basic and does not deal with extensions at all.
Any hints are appreciated.
There's no direct way for an application extension to read the managed app config that is provided to its containing app. There are two main ways that developers work around this.
Some extension types have their own arbitrary configuration that's very similar to managed app config. For instance, the profile payload that configures Extensible Single Sign On has an extension data key that provides a dictionary directly to the extension through that API.
The other option is for the containing app to write the data into a shared container that the extension later reads. This means the containing app must be launched first. It also means that when the managed app config changes there may be a delay in passing that change to the extension.
If neither of these will work for your app, please file feedback. If you do, please make sure to describe the extension type you're developing and explain the purpose of that config.