MAC address or other "unique" identifier

@Ryan, yes and no. If the App is Sandboxed, you’ll need specific entitlements.

The best way IMHO, is to write the data to a ‘shared’ location, such as /Library/ or Users/Shared/ this way it can be accessed by every user. You will most likely need elevated permissions to create the file in /Library/.

If you’re using the Mac App Store, I believe Apple already take care of this for you, although I’ve never tested it myself.

Just to compliment Thom, you can also get the volume UUID on the Mac using NSURL.

Keep in mind that on some drives the drive UUID is blank. I ran into this a few years ago on a netbook from Asus.

Ha! Which reminds me, that I have had some trouble with a few USB devices (formatted FAT32 or NTFS) that don’t have a UUID on the Mac OS, in which case I then created a UUID based upon the disks creation date and capacity (far form fool proof).

[quote=89654:@Ryan Hartz]Great discussion. Thanks to everyone for chiming in.

It sounds like there’s no one true, unique identifier like people’s fingerprints or SS numbers for machines.

Let me ask this… Since my desire for this is to “copy over” the initial registration of user A so user B, logging into the same computer but with his own credentials, doesn’t need to register since user A already did, is there a way to copy over the database file from user A’s appdata folder to user B’s? Keeping in mind that the db was empty prior to registering, and a db containing data = registered

Can you copy a file from startup on one credential to another?[/quote]

An alternative, if you have an intermediate server, is to generate a UUID and consider that your unique identifier, stored server-side. Similar to using a social security number (made up unique identifier) instead of a fingerprint. You can then tie all the metadata, server-side, to this identifier. Rules upon this metadata could let you do these manipulations with a degree of certainty while keeping a truly unique ID for each.

Not only that, but cloned VMs - like the ones downloaded from Microsoft - will have the same volume UUID. To work around this, I store a salt value in preferences, so the preferences file and volume become a matched pair. In this case, a volume without a UUID will at least still be salted and require another blank UUID for the preferences to match.

More info about this: https://forum.xojo.com/10597-uuidmbs-how-to-always-get-the-same-uuid

And other info here: http://stackoverflow.com/questions/671876/whats-a-good-way-to-uniquely-identify-a-computer

[quote=89654:@Ryan Hartz]
Let me ask this… Since my desire for this is to “copy over” the initial registration of user A so user B, logging into the same computer but with his own credentials, doesn’t need to register since user A already did, is there a way to copy over the database file from user A’s appdata folder to user B’s? Keeping in mind that the db was empty prior to registering, and a db containing data = registered

Can you copy a file from startup on one credential to another?[/quote]

If it is for Windows save the registration details in HKLM in the registry. If it is for a Mac just publish it to the App Store. Honestly, I would use the SID method. SIDs are unique to the Windows install rather than the hardware, but since you want your app to access a registration server then you’ll could code it so if the SID is different than the one that is on the server they can reactivate it and the other SID is deleted from the database.

Thank you to all who have contributed to this post. I think I found a solution to my needs, and that will include the MAC address. The SIDs was another option but I couldn’t get it to work on the Mac in testing.

I know there is a lot of debate on MAC addresses as the values can change with a computer repair or by the user themselves. As I mentioned earlier, I already have a pretty good registration process in place where I send out reg codes to the user. MAC address or computer identifiers not necessary.

My need for the unique identifier is for when the apps are use in colleges/universities. I am going to begin allowing individual students to log in with their own credentials after the IT dept has installed the program and registered it (currently have been instructing the IT guys to create a general login on the computer and give all students access to it - way too many phone calls to instruct on how to do this and ultimately, there could’ve been an infinite number of students using - cuts into profits). I wanted a way to prevent the need of the students having to see the registration screen, since this had already been done by the school staff. The reg screen comes up if the reg db is blank. I think with the MAC address, I’ll be able to get the students to connect to the server on first run only to see if the MAC address matches the one present. If it does, the reg db fills with the info, and that step is bypassed.

I’m sure you may cringe when reading that and think I’ll be getting many calls from the schools, but I think this method will relieve many of the calls I’ve received thus far. Plus, as always, I’ll build in a backdoor, should the school not be able to connect to the server, or some other reason.

Again, thank you all who have contributed your valuable thoughts

[quote=89894:@Ryan Hartz]Thank you to all who have contributed to this post. I think I found a solution to my needs, and that will include the MAC address. The SIDs was another option but I couldn’t get it to work on the Mac in testing.

I know there is a lot of debate on MAC addresses as the values can change with a computer repair or by the user themselves. As I mentioned earlier, I already have a pretty good registration process in place where I send out reg codes to the user. MAC address or computer identifiers not necessary.

My need for the unique identifier is for when the apps are use in colleges/universities. I am going to begin allowing individual students to log in with their own credentials after the IT dept has installed the program and registered it (currently have been instructing the IT guys to create a general login on the computer and give all students access to it - way too many phone calls to instruct on how to do this and ultimately, there could’ve been an infinite number of students using - cuts into profits). I wanted a way to prevent the need of the students having to see the registration screen, since this had already been done by the school staff. The reg screen comes up if the reg db is blank. I think with the MAC address, I’ll be able to get the students to connect to the server on first run only to see if the MAC address matches the one present. If it does, the reg db fills with the info, and that step is bypassed.

I’m sure you may cringe when reading that and think I’ll be getting many calls from the schools, but I think this method will relieve many of the calls I’ve received thus far. Plus, as always, I’ll build in a backdoor, should the school not be able to connect to the server, or some other reason.

Again, thank you all who have contributed your valuable thoughts[/quote]
Not to mention many can purposely duplicate MAC addresses with VMWare.

[quote=89894:@Ryan Hartz]The SIDs was another option but I couldn’t get it to work on the Mac in testing.
[/quote]
SIDs are Windows only.
I didn’t know you needed this for a Mac. You can just shell out to system_profiler and then you can get the Serial Number. But since you are selling it just put it on the Apple App Store.