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_valueuses.write.prefs.remove_keyuses.criticaland requires.fullAccess.
Tool Matrix
| Name | Id | Policy | Description |
|---|---|---|---|
List Preference Keys | prefs.list_keys | Read | Lists keys from a UserDefaults store. |
Get Preference Value | prefs.get_value | Read | Reads one preference value. |
Set Preference Value | prefs.set_value | Write | Writes one preference value. |
Remove Preference Key | prefs.remove_key | Critical | Deletes 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.