Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
204 views
in Technique[技术] by (71.8m points)

ios - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...