Unflattens the data in the passed buffer and creates a descriptor from it.


OSStatus AEUnflattenDesc(const void *buffer, AEDesc *result);



A pointer to memory, allocated by the application, that contains flattened data produced by a previous call to AEFlattenDesc.


A null descriptor. On successful completion, points to a descriptor created from the flattened data. The caller is responsible for disposing of the descriptor.

Return Value

A result code. Returns paramErr if the flattened data in buffer is found to be invalid. See Result Codes for other possible values.


This function assumes the passed buffer contains valid flattened data, produced by a previous call to AEFlattenDesc. See that function for a description of when you might want to flatten and unflatten descriptors, and of possible limitations.

Flattening and unflattening works across OS versions, including between Mac OS 9 and macOS.

Flattening is endian-neutral. That is, you can save flattened data on a machine that is either big-endian or little-endian, then retrieve and unflatten the data on either type of machine, without any special steps by your application.


Thread safe starting in OS X v10.2.

See Also

Serializing Apple Event Data


Returns the amount of buffer space needed to store the descriptor after flattening it.


Flattens the specified descriptor and stores the data in the supplied buffer.