<!--
{
  "availability" : [
    "iOS: 2.0.0 - 27.0.0",
    "iPadOS: 2.0.0 - 27.0.0",
    "macCatalyst: 13.1.0 - 27.0.0",
    "macOS: 10.4.0 - 27.0.0",
    "tvOS: 9.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "CFNetwork",
  "identifier" : "/documentation/CFNetwork/CFNetServiceCreateDictionaryWithTXTData(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "CFNetwork"
    ],
    "preciseIdentifier" : "c:@F@CFNetServiceCreateDictionaryWithTXTData"
  },
  "title" : "CFNetServiceCreateDictionaryWithTXTData(_:_:)"
}
-->

# CFNetServiceCreateDictionaryWithTXTData(_:_:)

Uses TXT record data to create a dictionary.

```
func CFNetServiceCreateDictionaryWithTXTData(_ alloc: CFAllocator?, _ txtRecord: CFData) -> Unmanaged<CFDictionary>?
```

## Parameters

`alloc`

The allocator to use to allocate memory for the new object. Pass `NULL` or <doc://com.apple.documentation/documentation/CoreFoundation/kCFAllocatorDefault> to use the current default allocator.

`txtRecord`

TXT record data as returned by [`CFNetServiceGetTXTData(_:)`](/documentation/CFNetwork/CFNetServiceGetTXTData(_:)).

## Return Value

A dictionary containing the key/value pairs parsed from `txtRecord`, or `NULL` if `txtRecord` cannot be parsed. Each key in the dictionary is a CFString object, and each value is a CFData object. 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

This function is thread safe.

---

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)