Created
January 16, 2019 23:02
-
-
Save xocialize/171ee3621df53b96ac58d91ae4d9bdf0 to your computer and use it in GitHub Desktop.
Hardware ID mac os
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://www.markcornelisse.nl/cocoa/cocoa-hardware-identifier-inside-os-x/ | |
import Foundation | |
import IOKit | |
public var hardwareUUID: NSUUID = { | |
var hwUUIDBytes: [UInt8] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] | |
var ts = timespec(tv_sec: 0,tv_nsec: 0) | |
gethostuuid(&hwUUIDBytes, &ts) | |
return NSUUID(UUIDBytes: hwUUIDBytes) | |
}() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment