Class

NSUUID

A universally unique value that can be used to identify types, interfaces, and other items.

Declaration

@interface NSUUID : NSObject

Overview

UUIDs (Universally Unique Identifiers), also known as GUIDs (Globally Unique Identifiers) or IIDs (Interface Identifiers), are 128-bit values. UUIDs created by NSUUID conform to RFC 4122 version 4 and are created with random bytes.

The standard format for UUIDs represented in ASCII is a string punctuated by hyphens, for example 68753A44-4D6F-1226-9C60-0050E4C00067. The hex representation looks, as you might expect, like a list of numerical values preceded by 0x. For example, 0xD7, 0x36, 0x95, 0x0A, 0x4D, 0x6E, 0x12, 0x26, 0x80, 0x3A, 0x00, 0x50, 0xE4, 0xC0, 0x00, 0x67. Because a UUID is expressed simply as an array of bytes, there are no endianness considerations for different platforms.

The NSUUID class is not toll-free bridged with CoreFoundation’s CFUUIDRef. Use UUID strings to convert between CFUUIDRef and NSUUID, if needed. Two NSUUID objects are not guaranteed to be comparable by pointer value (as CFUUIDRef is); use isEqual: to compare two NSUUID instances.

Topics

Creating UUIDs

UUID

Create and returns a new UUID with RFC 4122 version 4 random bytes.

init

Initializes a new UUID with RFC 4122 version 4 random bytes.

initWithUUIDString:

Initializes a new UUID with the formatted string.

initWithUUIDBytes:

Initializes a new UUID with the given bytes.

Get UUID Values

getUUIDBytes:

Returns the UUID as bytes.

UUIDString

The UUID as a string.

Relationships

Inherits From