<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "IOBluetooth",
  "identifier" : "/documentation/IOBluetooth/OBEXHeadersToBytes(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "IOBluetooth"
    ],
    "preciseIdentifier" : "c:@F@OBEXHeadersToBytes"
  },
  "title" : "OBEXHeadersToBytes(_:)"
}
-->

# OBEXHeadersToBytes(_:)

Converts a dictionary of headers to a data pointer, from which you can extract as bytes and pass to the OBEX command/response functions.

```
func OBEXHeadersToBytes(_ dictionaryOfHeaders: CFDictionary!) -> Unmanaged<CFMutableData>!
```

## Parameters

`dictionaryOfHeaders`

dictionary that you have added headers to with the above OBEXAddXXXHeader functions.

## Return Value

Mutable data ref containing the bytes of all headers.

## Discussion

Returns a CFMutableDataRef containing all the header data found in the dictionary, formatted according to the OBEX/IrMC spec. YOU MUST RELEASE IT when you are finished with it (ie. when the OBEX request is complete). All OBEX-specification defined headers are supported and should be returned to the dictionary. Use the keys defined above to get headers from dictionary. Example usage:

```objc
 
   Example usage:
 
   CFMutableDictionaryRef	dictionary;
   CFMutableDataRef		mGetHeadersDataRef;
   uint8_t* 				headerDataPtr;
   uint32_t 				headerDataLength;
 
   dictionary = CFDictionaryCreateMutable( kCFAllocatorDefault, 0, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks );
 
   // Package up desired headers.
 
   OBEXAddTypeHeader( CFSTR( "text/x-vCard" ), dictionary );
 
   mGetHeadersDataRef = OBEXHeadersToBytes( dictionary );
 
   headerDataPtr = CFDataGetBytePtr( mGetHeadersDataRef );
   headerDataLength = CFDataGetLength( mGetHeadersDataRef );
 
   // From here I can pass it to any OBEX command, such as OBEXPut...
 
```

---

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)