同步iPhone时间与服务器的最佳方式 [英] Best way to synchronize iPhone time with the server

查看:729
本文介绍了同步iPhone时间与服务器的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个客户端服务器模型,其中服务器将发送一些具有日期参数的数据,iPhone将需要渲染它。服务器和iPhone将驻留在不同的时区。所以我需要同步时间在两者。让我们说用户在07/18/2011/04 / 45 / EDT(服务器时间)做了一些活动。从iPhone端,我需要将此日期字符串转换为NSDate对象。

I have a client server model where server will send some data which has date parameters and iPhone will need to render it. Server and iPhone will resides in different timezones. So I need to synchronize times in both. Let say user has done some activity at "07/18/2011/04 /45/EDT" (server time). From the iPhone end I need to convert this date string into a NSDate object.

什么是最好的方式来实现这一点。

What is the best way to achieve this.

谢谢

推荐答案

为NSDate同步到服务器在谷歌和到这里。我陷入了同样的问题,写了这个很好的小类,这有助于。

Sorry for the late response, just looked for "NSDate Sync to Server" on google and got here. I got stuck with the same issue and written this nice little category that helps.

它可以返回一个NSDate对象,同步到只有一个HTTP请求(每个会话)的任何Web服务器。

It can return an NSDate object synced to any web server with only a single HTTP Request (per-session).

https://github.com/freak4pc/ NSDate-ServerDate

如果您有任何问题,请随时与我们联系。

If you have any questions feel free to let me know.

这篇关于同步iPhone时间与服务器的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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