View Full Version : Getting a unique identifier
davbeck
Mar 22, 2009, 11:52 AM
How do I get a unique identifier for a computer with cocoa? Or how can I tell that my application is running on a different machine?
Wes
Mar 22, 2009, 12:36 PM
MAC address seems like a good choice here.
From the terminal you can do ifconfig en0. You can make a system call and parse that. I don't know the Cocoa API but I assume Apple will have a wrapped that too, potentially here:
http://developer.apple.com/documentation/Networking/Conceptual/SystemConfigFrameworks/SC_UnderstandSchema/SC_UnderstandSchema.html#//apple_ref/doc/uid/TP40001065-CH203-CHDDEDFJ
MrFusion
Mar 22, 2009, 01:33 PM
MAC address seems like a good choice here.
From the terminal you can do ifconfig en0. You can make a system call and parse that. I don't know the Cocoa API but I assume Apple will have a wrapped that too, potentially here:
http://developer.apple.com/documentation/Networking/Conceptual/SystemConfigFrameworks/SC_UnderstandSchema/SC_UnderstandSchema.html#//apple_ref/doc/uid/TP40001065-CH203-CHDDEDFJ
A MAC address can be changed. Don't use it for security applications.
Wes
Mar 22, 2009, 01:37 PM
http://developer.apple.com/samplecode/GetPrimaryMACAddress/listing1.html
There's a little code.
I guess you could also get the serial number:
http://discussions.apple.com/thread.jspa?threadID=1906402&tstart=105
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.