Reputation: 47981
How do I generate a UUID that will uniquely identify a computer using Xcode / Objective-C? Windows has UuidCreateSequential()
, what can I use on a Mac?
Upvotes: 2
Views: 4175
Reputation: 4288
You can read the system serial number or the hardware MAC addresses using IOKit.
Check out Apple Technical Note TN1103 ("Uniquely Identifying a Macintosh Computer") for sample code and more information.
Upvotes: 2
Reputation: 25271
Try this:
CFUUIDRef UUID = CFUUIDCreate(kCFAllocatorDefault);
CFStringRef UUIDString = CFUUIDCreateString(kCFAllocatorDefault,UUID);
// UUIDString is the CFStringRef (== NSString *) that contains the UUID.
// Cleanup
CFRelease(UUID);
CFRelease(UUIDString);
Upvotes: 3