Understand the saved settings affecting app behavior

Inspect approved preference values in your iOS app and make targeted changes during local debugging.

Preferences tools help explain behavior that depends on saved configuration or user state. Read the allowed stores and keys, then enable writes or removal only when you need to test or repair a specific setting.

Install

Published pod: AnsightToolsPreferences.

SwiftPM:

.product(name: "AnsightToolsPreferences", package: "ansight-sdk")

CocoaPods:

pod 'AnsightToolsPreferences'

Register the Suite

import AnsightCore
import AnsightToolsPreferences

let preferences = AnsightPreferencesToolOptions(
    defaultStore: "com.example.app",
    allowedStores: ["com.example.app"],
    allowedKeyPrefixes: ["debug."]
)

try AnsightRuntime.shared.registerPreferencesTools(options: preferences)

Registration API

  • registerPreferencesTools(options:): registers the suite.
  • AnsightPreferencesToolOptions(defaultStore:allowedStores:allowedKeys:allowedKeyPrefixes:): configures store and key allow-lists.

Specific Concerns

  • Preference values often include configuration or user state.
  • Restrict stores, keys, or key prefixes at registration time.
  • prefs.set_value uses .write.
  • prefs.remove_key uses .critical and requires .fullAccess.

Tool Matrix

NameIdPolicyDescription
List Preference Keysprefs.list_keysReadLists keys from a UserDefaults store.
Get Preference Valueprefs.get_valueReadReads one preference value.
Set Preference Valueprefs.set_valueWriteWrites one preference value.
Remove Preference Keyprefs.remove_keyCriticalDeletes one preference key.

Tool Details

Use prefs.list_keys and prefs.get_value for inspection. Use prefs.set_value and prefs.remove_key only for local repair workflows where the allowed store and key policy is narrow.