JohnK
JohnK

Reputation: 7337

Is there any way to get the tamper-proof date and time on iPhone?

For various reasons I need to get from the iPhone the current date and time that can't be meddled with by the user. Yes, I've seen how one can check a server (e.g., here), but that's not invulnerable to tampering if you take a moment to reflect.

There are two knee-jerk reactions I'm expecting to hear:

  1. Use the GPS time.
  2. It can't be done.

In answer to another question, I've described my researches into this matter. To summarize them:

  1. The GPS time shifts with the user-defined settings.
  2. The iPhone definitely has an internal tamper-proof time and date, as shown when date-time reverts after Set Automatically in Settings > General > Time & Date is turned back to on even in a fallout shelter.

What I want to know is how to access this tamper-proof time.


Edit

Just to be clear, the server-based solution is not suitable. For one, it could be faked. For another, the app needs to work without a network connection.

Upvotes: 8

Views: 2125

Answers (1)

Michael Dautermann
Michael Dautermann

Reputation: 89509

Assuming you always have Internet available, you could implement a class or object that connects to a remote Network Time Protocol server.

Here's an open source GitHub project that should get you started, and the related StackOverflow question I found it at.

Upvotes: 2

Related Questions