2011-08-28 66 views
3

我用這個代碼來獲得UUID在Mac OSMac OS UUID是否依賴於硬盤?

NSString* getComputerId() 
{ 
    io_registry_entry_t ioRegistryRoot = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/"); 
    CFStringRef uuidCf = (CFStringRef) IORegistryEntryCreateCFProperty(ioRegistryRoot, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); 
    IOObjectRelease(ioRegistryRoot); 
    return (NSString*) uuidCf; 
} 

這是否UUID取決於硬盤?如果用戶更換硬盤,UUID是否會更改?

回答