Instance Property

bytes

A pointer to the data object's contents.

Declaration

@property(readonly) const void *bytes;

Discussion

If the length of the NSData object is 0, this property returns nil.

For an immutable data object, the returned pointer is valid until the data object is deallocated. For a mutable data object, the returned pointer is valid until the data object is deallocated or the data is mutated.

See Also

Accessing Underlying Bytes

- enumerateByteRangesUsingBlock:

Enumerates each range of bytes in the data object using a block.

- getBytes:

Copies a data object’s contents into a given buffer.

Deprecated
- getBytes:length:

Copies a number of bytes from the start of the data object into a given buffer.

- getBytes:range:

Copies a range of bytes from the data object into a given buffer.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software