Teach my app to pick settings from a mobileconfig file

Hi,

I am currently struggling with making my own app to pick up its settings from a mobileconfig that is distributed via MDM.

For example, I can feed any arbitrary homepage URL string to Mozilla Firefox using a .mobileconfig file:
Code Block <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>EnterprisePoliciesEnabled</key>
<true/>
<key>Homepage</key>
<dict>
<key>Locked</key>
<true/>
<key>StartPage</key>
<string>homepage</string>
<key>URL</key>
<string>https://mywebsite.com</string>
</dict>
<key>PayloadDescription</key>
<string>Configures Firefox settings</string>
<key>PayloadDisplayName</key>
<string>Firefox</string>
<key>PayloadIdentifier</key> <string>C227595B-6AD4-4F2E-A06E-33DD6814FF2D.org.mozilla.firefox.2C284A01-E458-4BBC-B185-021CCC8CB070</string>
<key>PayloadType</key>
<string>Configuration</string>
<key>PayloadUUID</key>
<string>2C284A01-E458-4BBC-B185-021CCC8CB071</string>
<key>PayloadVersion</key>
<integer>1</integer>
</dict>
</array>
<key>PayloadDescription</key>
<string>This profile sets the Firefox homepage to https://veeam.com</string>
<key>PayloadDisplayName</key>
<string>Firefox - Set Homepage</string>
<key>PayloadIdentifier</key>
<string>C227595B-6AD4-4F2E-A06E-33DD6814FF2D</string>
<key>PayloadOrganization</key>
<string>Tidemdm</string>
<key>PayloadScope</key>
<string>System</string>
<key>PayloadType</key>
<string>Configuration</string>
<key>PayloadUUID</key>
<string>C227595B-6AD4-4F2E-A06E-33DD6814FF2D</string>
<key>PayloadVersion</key>
<integer>1</integer>
</dict>
</plist>

How do I teach my own app to accept such config files?
I guess I have to somehow tell my app to lookup for certain values in its preferences domain, but I haven't found any documentation on that yet.

Please advise

Thanks!
Inside the PayloadContent dictionary try changing the PayloadType from Configuration to org.mozilla.firefox. The Configuration type should only be set on the top level profile dict.
Hi,

Well, the questions was how to make my self-made app to accept configuration from MDM.

That is, I guess that MDM pushes .mobileconfig files' content somewhere in the system. After that Firefox reads those values.

I am trying to figure out how to make my own app (not firefox) to read those values, and where it should read it form

Thanks!
Your application should use CFPreferencesCopyAppValue() to read in the managed preference installed by your configuration profile payload. The preference domain will be the PayloadType key value and your keys are placed into the payload dictionary (at the same level as the EnterprisePoliciesEnabled key in your Firefox example). Once you install the profile, the keys should show up in /Library/Managed Preferences/<username>/<bundle ID>.plist. Note that the <username> folder isn’t used for device level profiles. CoreFoundation will automatically pick up the managed preferences once you install the profile, as long as you use CFPreferencesCopyAppValue or NSUserDefaults to access the preference keys.
Teach my app to pick settings from a mobileconfig file
 
 
Q