<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "dnssd",
  "identifier" : "/documentation/dnssd/TXTRecordContainsKey(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "dnssd"
    ],
    "preciseIdentifier" : "c:@F@TXTRecordContainsKey"
  },
  "title" : "TXTRecordContainsKey(_:_:_:)"
}
-->

# TXTRecordContainsKey(_:_:_:)

Allows you to determine if a given TXT Record contains a specified key.

```
func TXTRecordContainsKey(_ txtLen: UInt16, _ txtRecord: UnsafeRawPointer!, _ key: UnsafePointer<CChar>!) -> Int32
```

## Parameters

`txtLen`

The size of the received TXT Record.

`txtRecord`

Pointer to the received TXT Record bytes.

`key`

A null-terminated ASCII string containing the key name.

## Return Value

Returns 1 if the TXT Record contains the specified key. Otherwise, it returns 0.

---

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)