NSUUID Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/Foundation.framework |
| Availability | Available in iOS 6.0 and later. |
| Declared in | NSUUID.h |
Overview
The NSUUID class creates UUID strings that are to uniquely identify types, interfaces, and other items.
UUIDs (Universally Unique Identifiers), also known as GUIDs (Globally Unique Identifiers) or IIDs (Interface Identifiers), are 128-bit values A UUID is made unique over both space and time by combining a value unique to the computer on which it was generated and a value representing the number of 100-nanosecond intervals since October 15, 1582 at 00:00:00.
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.
Class Methods
UUID
Create and returns a new UUID with RFC 4122 version 4 random bytes.
Return Value
A new UUID object.
Availability
- Available in iOS 6.0 and later.
Declared In
NSUUID.hInstance Methods
getUUIDBytes:
Returns the UUIDs bytes.
Parameters
- uuid
The value of uuid represented as raw bytes.
Availability
- Available in iOS 6.0 and later.
Declared In
NSUUID.hinit
Create and returns a new UUID with RFC 4122 version 4 random bytes.
Return Value
A new UUID object.
Availability
- Available in iOS 6.0 and later.
Declared In
NSUUID.hinitWithUUIDBytes:
Creates and returns a new UUID with the given bytes.
Parameters
- bytes
Raw UUID bytes to use to create the UUID.
Return Value
A new UUID object.
Availability
- Available in iOS 6.0 and later.
See Also
Declared In
NSUUID.hinitWithUUIDString:
Creates and returns a new UUID from the formatted string.
Parameters
- string
The source string containing the UUID. The standard format for UUIDs represented in ASCII is a string punctuated by hyphens, for example
68753A44-4D6F-1226-9C60-0050E4C00067.
Return Value
A new UUID object. Returns nil for invalid strings.
Availability
- Available in iOS 6.0 and later.
See Also
Declared In
NSUUID.hUUIDString
Returns the UUID as a string.
Return Value
A string containing a formatted UUID for example E621E1F8-C36C-495A-93FC-0C247A3E6E5F.
Discussion
Use this method to create a string representation of the NSUUID object to compare with a CFUUIDRef.
Availability
- Available in iOS 6.0 and later.
Declared In
NSUUID.h© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-07-17)