[iOS] get MDM settings from system dictionary in swift

透過 iOS MDM 派送參數給 Device,範例程式如下:

Develop an app that supports Managed AppConfig on iOS

Fetch managed AppConfig using the following code:

func fetchAppConfiguration() {
     if let managedConfigDict = UserDefaults.standard.dictionary(forKey: "com.apple.configuration.managed"){
          if let keyValue = managedConfigDict["keyName"]{
               print("KEY : keyname \nVALUE : \(keyValue) ")
          print("Error fetching app config values. Please make sure your device is enrolled with AirWatch ")


Register your app to listen for managed AppConfig changes:

Developers can register their app to listen for userdefault changes. This action allows the app to dynamically pick up the latest managed AppConfig sent by AirWatch.

func registerForAppConfigNotification() {
     NotificationCenter.default.addObserver(self, selector: #selector(ViewController.fetchAppConfiguration), 
          name: UserDefaults.didChangeNotification, object: nil)





Configure Managed Settings for iOS Devices


發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *