3

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?

user486134
  • 405
  • 1
  • 6
  • 13

1 Answers1

1

There's no mention of the HDD in the CFUUID documentation

Goibniu
  • 2,212
  • 3
  • 34
  • 38