开发者

Does Mac OS UUID depend on hard disk?

开发者 https://www.devze.com 2023-04-01 10:16 出处:网络
I use this code to get UUID on Mac OS NSString* getComputerId() { io_registry_entry_t ioRegistryRoot = IORegistryEntryFromPath(kIOMasterPortDefault, \"IOService:/\");

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

0

精彩评论

暂无评论...
验证码 换一张
取 消