有没有办法确定iOS中的实际时间和日期(而不是设备的时间) [英] Is there a way to determine the actual time and date in iOS (not the time of the device)

查看:118
本文介绍了有没有办法确定iOS中的实际时间和日期(而不是设备的时间)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iOS中,我需要知道实际时间(UTC),而不是设备的时间。换句话说,用户不应该篡改时间或日期。



任何需要网络连接的地方都不好(因此访问时间服务器不是一种选择)。



AFAIK,有两种理论方法可以达到这个目的:


  • 使用GPS卫星信号中的时间戳

  • 从运营商处获取当前时间


问题是这些信息没有被iOS中的任何API暴露。



有没有另外一种方法?


In iOS, I need to know the actual time (UTC), not the time of the device. In other words, it should not be possible for the user to tamper with the time or date.

Anything that requires a network connection is not good (so accessing a time server is not an option).

AFAIK, there are 2 theoretical ways of achieving this:

  • Use the timestamp from the GPS satellite signal
  • Get the current time from the carrier

Problem is that this information is not exposed by any API in iOS.

Is there another way?

解决方案

Most solutions you could possibly find (including getting GPS data from CoreLocation to access the time information) are flawed because they are depending on the actual device to access time time. You will need to connect to a time server (i would suggest to check for NTP server). I was looking at the core telephony framework and couldn't find anything that would provide the network time. You might want to fill a bug report and request apple to expand one of the classes to include the time.

这篇关于有没有办法确定iOS中的实际时间和日期(而不是设备的时间)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆