GUID V4 - Random-Based Identifier (Recommended)
GUID v4 is the most widely used random-based identifier. Learn about its structure, collision probability, advantages and why it is recommended for general-purpose applications.
Generate UUIDs in Objective-C with NSUUID for native random v4 values. If you need UUID v7 on Apple platforms, use a third-party RFC 9562-compatible library because Foundation does not expose it directly.
NSUUID for portable random identifiers, and only add UUID v7 through a vetted library when time ordering is a real requirement.NSUUID *uuid = [[NSUUID alloc] init];
NSString *value = uuid.UUIDString;
NSLog(@"%@", value);Foundation does not provide native UUID v7 generation in Objective-C. Use a vetted third-party library that explicitly documents RFC 9562 UUID v7 support if your project needs sortable UUIDs.
// Foundation does not expose native UUID v7 generation.
// Use a third-party RFC 9562-compatible library when UUID v7 is required.NSUUID type.[[NSUUID alloc] init] creates RFC 4122 version 4 random bytes.NSUUID, which is the normal native API for random UUID generation.NSUUID generates random RFC 4122 version 4 UUID values, not time-ordered UUID v7 values.These articles expand on related concepts, formats and practical considerations.