Organizational Research By

Surprising Reserch Topic

how can i locally detect iphone clock advancement by a user between app runs

how can i locally detect iphone clock advancement by a user between app runs  using -'iphone,objective-c,ios,clock,anti-cheat'

A common exploit in casual games is to artificially advance the system clock to jump ahead in gameplay.  How can such user clock advancement be detected by an app on an iOS device?

Must not involve network communication
Must not assume app is open (running or suspended) while clock is advanced
Must detect clock advancement, detecting clock rollback is not sufficient

Ideally, the solution would be robust against reboots, but that is not a requirement.

asked Sep 15, 2015 by Mil18C
0 votes

Related Hot Questions

4 Answers

0 votes

I was thinking about the fact that the CoreLocation stuff could do this if that part of the GPS data was exposed to you. However that got me thinking.

My only (far fetched) suggestion is to put something into background processing - which has to be for one of a small specific set of reasons, for example to track location in the background. As a side effect of that, try to detect a clock change on a regular timer. Apple might reject it as it may be clear that its not using the location information and its just a reason to exploit background processing.

Any solution not involving networking is so much harder to implement, I wonder why you're not using it.

answered Sep 15, 2015 by JestineFreyp
0 votes

Whilst I don't think it's possible to reliably determine whether or not a user has manually turned their clock forward without network access, you can of course reliably determine if they've travelled back in time. And since we know this to be physically impossible it can therefore be assumed they have manipulated their clock to cheat.

What I mean by this is, isn't the usual process to trigger some action in-app that requires a period of waiting, exit the app and turn the clock forward, re-launch the app to gain whatever they were waiting for and then reset the clock back to the actual time?

If this is indeed the case, then to build on the suggestion by @smgambel, you could store the physical time and current time-zone on each launch and compare with the previously stored time and time-zone. If the time is behind the previously stored time, and the time-zone of the device hasn't changed then you can safely assume the user has manipulated the clock.

answered Sep 15, 2015 by CleoNicholls
0 votes

This is very easy. You need only save the last NSDate upon exit of the app, and then check it on the start of the app. Try:

NSDate * newTime = [NSDate date];
NSDate * oldTime = // Saved date, you can use NSUserDefaults if you want!
float timeSinceSaved = [newTime timeIntervalSinceDate:oldTime]

And that will give you how many seconds it's been since the app exited. Hope that helps!

answered Sep 15, 2015 by ClaMcConnan