I use this code to get UUID on Mac OS
NSString* getComputerId()
{
io_registry_entry_t ioRegistryRoot = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/");
CFStringRef uuidCf = (CFStringRef) IORegistryEntryCreateCFProperty(ioRegistryRoot, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0);
IOObjectRelease(ioRegistryRoot);
return (NSString*) uuidCf;
}
Does this UUID depend on hard disk? Will UUID change if users 开发者_运维百科replace their hard disk?
There's no mention of the HDD in the CFUUID documentation
精彩评论