2016-07-29 1 views
-1

시간대의 현재 시간을 알 수있는 사람이 있습니까?시스템/모바일 시간이 아닌 현재 시간대에서 시간을 얻으십시오.

사용자가 인도 표준 시간대 (예 : 오후 5시)를 사용하지만 모바일 시간이 오후 5시 30 분까지 정적으로 변경되면 여기에 사용자가 변경 한 모바일 시간이 아니라 실제 시간대 시간이 필요합니다. 우선권.

+0

class ViewController: UIViewController { let netAssociation = NetAssociation(serverName: "time.apple.com") func viewDidLoad() { super.viewDidLoad() netAssociation.delegate = self netAssociation.sendTimeQuery() } func reportFromDelegate() { let timeOffset = netAssociation.offset // serverTime will always be in UTC. Use an NSDateFormatter // to display it in your local timezone let serverTime = NSDate(timeIntervalSince1970: timeOffset) } } 
([사용자를 검출하는 방법 아이폰 OS는 시스템 시간을 변경하고있다 시간 서버 장치의 시간과 비교되지 않은 경우] http://stackoverflow.com/questions/32457797/ 사용자가 변경 한 시스템 시간 및 비교하지 않을 경우 장치 시간) – Westside

+0

This [gist] (https://gist.github.com/krishashok/) 8002711) 당신이 찾고있는 것일 수 있습니다. – sketchyTech

답변

1

세계 시계에 액세스해야하는 경우 NTP 서버에 문의하십시오. Cocoapods로 가서 그것을 할 수있는 꼬투리를 찾으십시오. 아래 예 ios-ntp위한 :

가능 중복