I'm using this method in order to get the timeZone
from lat/long
.
-(void)getTimeZoneFromLatLong
{
CLLocation *location = [[CLLocation alloc] initWithLatitude:self.parentVC.currentCity.latitude.doubleValue longitude:self.parentVC.currentCity.longitude.doubleValue];
CLGeocoder *geoCoder = [[CLGeocoder alloc]init];
[geoCoder reverseGeocodeLocation: location completionHandler:^(NSArray *placemarks, NSError *error)
{
CLPlacemark *placemark = [placemarks objectAtIndex:0];
_placemark = placemark;
}];
}
Then I can use the timeZone
in order to call :
EDSunriseSet *eds = [EDSunriseSet sunrisesetWithTimezone:_placemark.timeZone
latitude:latitude.doubleValue longitude:longitude.doubleValue];
EDSunriseSet
is a library in order to get Sunrise/Sunset
values from lat/long
and timeZone
.
It's working perfectly, however Crashlytics
is alerting me that [CLPlacemark timeZone]
is incompatible with iOS8
and lower.
How can I adapt my code for iOS8
?
EDIT: [_placemark timezone]
and _placemark.timezone
are both accepted ?