Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I locally detect iPhone clock advancement by a user between app runs?

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.

like image 478
David Lee Avatar asked Aug 19 '11 13:08

David Lee


People also ask

Can you see app usage history on iPhone?

Go to Settings > Screen Time. Tap See All Activity, then tap Week to see a summary of your weekly use, or tap Day to see a summary of your daily use.

How can I tell when my iPhone was last used?

Open the Settings app and tap General > iPhone or iPad Storage. On the next screen, you'll find useful information about your device, including storage space usage, recommendations on saving space, and a list of the installed apps. You'll also find the Last Used date, with apps never opened marked as Never Used.


1 Answers

CACurrentMediaTime & mach_absolute_time

Take a look at this questions:

iOS: How to measure passed time, independent of clock and time zone changes?

Calculating number of seconds between two points in time, in Cocoa, even when system clock has changed mid-way

CACurrentMediaTime uses mach_absolute_time: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/CoreAnimation_functions/Reference/reference.html

Here you have an example on how to use CACurrentMediaTime: http://www.informit.com/blogs/blog.aspx?b=02b4e309-308c-468a-bab1-cebb1404be6a

Here you have a more information on mach_absolute_time: http://developer.apple.com/library/mac/#qa/qa1398/_index.html http://shiftedbits.org/2008/10/01/mach_absolute_time-on-the-iphone/

like image 116
Lio Avatar answered Oct 16 '22 05:10

Lio