Question

In my app, user can play several different games, However, unless a user purchases premium version, he will be able to play only few games a day.

I would like to make some sort of counter. So, each time you play a game, i call counter++ and check if the counter value is 4. If it is, I would put another value to false, and disable the start game buttons and display a message "Buy premium account in order to play unlimited games..." When a user starts a game tomorrow, he should have another 4 attempts to play a game.

Can anyone point me out on how would I check if the day passed? Any suggestions are welcome, since I don't have a clear idea how exacty to do this.

Thanks in advance

Was it helpful?

Solution

Each time you play a game you need to store date and increment count.

You should use low level mach functions to get time, to avoid iOS date/time correction by players.

Also it is better not to store the number explicitly.

If you want to store info in User Defaults you should hash or encrypt the data you store.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top