简体   繁体   English

iOS定位服务:CLLocation的时间戳问题

[英]iOS location services: CLLocation's timestamp issue

I'm developing an iOS 7+ app that needs to get accurate location updates and their timestamp, in order to know the time when a user reaches certain locations. 我正在开发一个iOS 7+应用,该应用需要获取准确的位置更新及其时间戳,以便了解用户到达特定位置的时间。 The problem is that the timestamp property of the CLLocation objects received in the locationManager:didUpdateLocations: delegate method seem to depend on the time settings of the device, they aren't universal times. 问题在于,在locationManager:didUpdateLocations:委托方法中收到的CLLocation对象的timestamp属性似乎取决于设备的时间设置,它们不是通用时间。 So, since a user can "fake" the time of her device, I can't rely on that information. 因此,由于用户可以“伪造”设备的时间,因此我不能依赖该信息。

ASFAIK, it is possible in Android apps to get the NMEA data from GPS and then get the universal time of positions, but I can´t find that in iOS. ASFAIK,可以在Android应用中从GPS获取NMEA数据,然后获取通用位置时间,但我在iOS中找不到。 Is there any alternative to solve this problem in iOS apps? 在iOS应用中是否可以解决此问题?

EDIT: related to this issue: is it possible to detect if the user changes her device's timezone, date or time while the app is running, even in the background? 编辑:与这个问题相关:是否可以检测用户是否在应用程序运行时更改了设备的时区,日期或时间,即使在后台也是如此?

Thanks in advance 提前致谢

If you need to get true GEO timestamp from iDevice I think you should call a Time API. 如果您需要从iDevice获取真实的GEO时间戳,我认为您应该调用Time API。 Recommend Google Time API. 推荐Google Time API。 Just submit device's GPS and the local timestamp the API will return timezone, rawOffset, daylight time saving etc... So you can calculate correct device's date time. 只需提交设备的GPS和本地时间戳,API就会返回时区,rawOffset,夏时制等。因此,您可以计算出正确的设备日期时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM