How does my Cocoa application store the user license key?

After the user enters his license key, my application is activated with this key (online). How to save this activated state and license key so that the next time the user opens the application, the application finds out that it is already activated?

+5
source share
5 answers

I just wrote a user license key and corresponding email address in a file in "~ / Library / Application Support / MyApplication / License.myApplicationlicense". I think this is better than using NSUserDefaults, because the user will expect to be able to toss their privileges without having anything dramatic, like re-registering their application.

A file is simply NSDictionary content written using writeToFile: atomically: and read using the dictionaryWithContentsOfFile :. The content is not encrypted, but this is usually not important depending on how your licensing scheme works.

AquaticPrime, . , , . , , AquaticPrime, , . AquaticPrime -, , .

+2

Apple . API Keychain.

+10

, , , , . NSUserDefaults dot . . , , , - , . , , , .

. , ? , , . , , 5 . , ? - , keymaker. , , , , , , , . , , , .

:

+2

I decided to use NSKeyedArchiver because it stores the data in encoding, so it’s more difficult to manually access and change sensitive data such as license key and activated state.

+1
source

You can use NSUserDefaults or your own project system.

0
source

All Articles