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

# xpc_dictionary_set_data(_:_:_:_:)

Inserts a raw data value into a dictionary.

```
func xpc_dictionary_set_data(_ xdict: xpc_object_t, _ key: UnsafePointer<CChar>, _ bytes: UnsafeRawPointer?, _ length: Int)
```

## Parameters

`xdict`

The dictionary which is to be manipulated.

`key`

The key for which the primitive value shall be set.

`bytes`

The bytes to insert. After calling this method, the XPC object corresponding to the primitive value inserted may be safely retrieved with [`xpc_dictionary_get_value(_:_:)`](/documentation/XPC/xpc_dictionary_get_value(_:_:)).

`length`

The length of the data.

## 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)