ios - How to get timezone by latitude and longitude -


this question has answer here:

i need display date , time based on given lat/long in app. worked google api timezone id, should work offline too. there way timezone without being connected internet?

try 1 :

cllocation *location = [[cllocation alloc] initwithlatitude:50.449846                                                   longitude:30.523629];  nstimezone *timezone = [[aptimezones sharedinstance] timezonewithlocation:location]; nslog(@"%@", timezone); 

find library here : https://github.com/alterplay/aptimezones


you can code (answered https://stackoverflow.com/a/27054583/3202193):

cllocation *currentlocaiton = [[cllocation alloc] initwithlatitude:latitude longitude:longitude];  [geocoder reversegeocodelocation:currentlocaiton completionhandler:^(nsarray *placemarks, nserror *error) {      if (error == nil && [placemarks count] > 0) {          placemark = [placemarks lastobject];          nsregularexpression *regex = [nsregularexpression regularexpressionwithpattern:@"identifier = \"[a-z]*\\/[a-z]*_*[a-z]*\"" options:nsregularexpressioncaseinsensitive error:null];         nstextcheckingresult *newsearchstring = [regex firstmatchinstring:[placemark description] options:0 range:nsmakerange(0, [placemark.description length])];         nsstring *substr = [placemark.description substringwithrange:newsearchstring.range];         nslog(@"timezone id %@",substr);       } 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -