我如何获得“互联网时间”?在iOS上? [英] How can I get the "internet time" on iOS?

查看:83
本文介绍了我如何获得“互联网时间”?在iOS上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在开发基于时间的应用程序,但是使用NSDate,用户可以通过更改设备的系统时间轻松地对应用程序进行黑客入侵。因此,我可能想使用更好的方法来获取时间。

So, I'm developing an app that is based on the time, but with NSDate an user can easily hack the application by changing system time of the device. So I might want to use a better method for retrieving time.

我该怎么做?有没有一种简便的方法可以从互联网上获取时间?

How can I do this? Is there an easy way to retrieve time from internet?

推荐答案

检出此Google图书馆: https://github.com/jbenet/ios-ntp

Checkout this Google Library: https://github.com/jbenet/ios-ntp

之后库已设置,您可以在以下行中使用它:

After the library is set up you can use it with the following line:

[NSDate networkDate];

这里也回答了类似的问题:从Apple服务器获取日期和时间

A similar question has also been answered here: Get Date and Time from Apple Server

这篇关于我如何获得“互联网时间”?在iOS上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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