---
title: "SCPreferencesGetValue(_:_:)"
framework: systemconfiguration
role: symbol
role_heading: Function
path: "systemconfiguration/scpreferencesgetvalue(_:_:)"
---

# SCPreferencesGetValue(_:_:)

Retrieves the value associated with the specified preference key.

## Declaration

```swift
func SCPreferencesGetValue(_ prefs: SCPreferences, _ key: CFString) -> CFPropertyList?
```

## Parameters

- `prefs`: The preferences session.
- `key`: The preference key.

## Return Value

Return Value The value associated with the specified preference key (can be NULL if no value exists).

## Discussion

Discussion To avoid inadvertantly reading stale data, first call SCPreferencesLock(_:_:) before calling this function.

## See Also

### Adding, Getting, and Removing Values

- [SCPreferencesAddValue(_:_:_:)](systemconfiguration/scpreferencesaddvalue(_:_:_:).md)
- [SCPreferencesSetValue(_:_:_:)](systemconfiguration/scpreferencessetvalue(_:_:_:).md)
- [SCPreferencesRemoveValue(_:_:)](systemconfiguration/scpreferencesremovevalue(_:_:).md)
