Project Address: https://github.com/jbenet/ios-ntp
NTP Wikipedia: http://en.wikipedia.org/wiki/Network_Time_Protocol
Ready to work
git clone project ios-ntp
https://github.com/jbenet/ios-ntp.git
git clone project CocoaAsyncSocket
https://github.com/robbiehanson/CocoaAsyncSocket.git
1, add frameworks
The decompression ios-ntp / release / ios-ntp.tar.gz, to give ios-ntp.framework folder, copy to the project
Targets -> Build Phases -> Link Binary With Libraries, click + to bring up the framwork list, click add others ... button to select the ios-ntp.framework
添加CFNetwork.framework
2, add CocoaAsyncSocket dependent files
Add files, select CocoaAsyncSocket / AsyncUdpSocket.h and AsyncUdpSocket.m two files in the directory RunLoop
Code Example:
NSDate *networkTime = [NSDate networkDate]; networkTimeLable.text = [NSString stringWithFormat:@"%@", networkTime];
Reproduced in: https: //www.cnblogs.com/dyingbleed/archive/2013/01/15/2860712.html