views:

34

answers:

1

Hi, I am new to programming for the iPhone. I want to allow my users to participate in a competition, to a maximum of n times a day. Is there anyway of going about that programmatically and/or through a server for optimal security (i have done NSUserDefaults). ?

Is it possible to get the database server to check the number of entries made by a device and send a call back to the application if it has exceeded n number of attempts for that day?

thank you for any suggestions.

A: 

Sure you can!

Each iPhone/iPod Touch device has a unique identifier you can get from the UIDevice class. When the app launches, bring up a screen that says "authenticating" and send that unique ID to your server in a simple HTTP GET request. On the server, you can log the identifier and a timestamp to a database and see how many times that same identifier has been seen in a 24 hour period. For this, you could use standard MySQL + PHP. The server could send back a simple "Yes" or "No" depending on the competition rules.

You definitely want it to go through a server. People can get around limitations saved in your NSUserDefaults by uninstalling and reinstalling the app. Using a server also has other benefits. It would allow you to modify the competition rules after deploying the application without waiting for a 14-day app update review from Apple.

Ben

Ben Gotow
much appreciated, thanks!
Abdulla Bedir