<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSAppleEventDescriptor/descriptorWithDescriptorType:bytes:length:",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSAppleEventDescriptor(cm)descriptorWithDescriptorType:bytes:length:"
  },
  "title" : "descriptorWithDescriptorType:bytes:length:"
}
-->

# descriptorWithDescriptorType:bytes:length:

Creates a descriptor initialized with the specified event type that stores the specified data (from a series of bytes).

```
+ (NSAppleEventDescriptor *) descriptorWithDescriptorType:(DescType) descriptorType bytes:(const void *) bytes length:(NSUInteger) byteCount;
```

## Parameters

`descriptorType`

The descriptor type to be set in the returned descriptor.

`bytes`

The data, as a sequence of bytes, to be set in the returned descriptor.

`byteCount`

The length, in bytes, of the data to be set in the returned descriptor.

## Return Value

A descriptor with the specified type and data, or `nil` if an error occurs.

---

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)