<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFPreferencesCopyKeyList(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@F@CFPreferencesCopyKeyList"
  },
  "title" : "CFPreferencesCopyKeyList(_:_:_:)"
}
-->

# CFPreferencesCopyKeyList(_:_:_:)

Constructs and returns the list of all keys set in the specified domain.

```
func CFPreferencesCopyKeyList(_ applicationID: CFString, _ userName: CFString, _ hostName: CFString) -> CFArray?
```

## Parameters

`applicationID`

The ID of the application whose preferences to search. Takes the form of a Java package name, `com.foosoft`.

`userName`

[`kCFPreferencesCurrentUser`](/documentation/CoreFoundation/kCFPreferencesCurrentUser) to search the current-user domain, otherwise [`kCFPreferencesAnyUser`](/documentation/CoreFoundation/kCFPreferencesAnyUser) to search the any-user domain.

`hostName`

[`kCFPreferencesCurrentHost`](/documentation/CoreFoundation/kCFPreferencesCurrentHost) to search the current-host domain, otherwise [`kCFPreferencesAnyHost`](/documentation/CoreFoundation/kCFPreferencesAnyHost) to search the any-host domain.

## Return Value

The list of keys. Ownership follows the [The Create Rule](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-103029).

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)