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

前端 未结 3 1562
我在风中等你
我在风中等你 2020-11-29 07:52

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

3条回答
  •  误落风尘
    2020-11-29 08:25

    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/

提交回复
热议问题