I made necessary changes for my app according to iOS8.1 SDK to track location. I am using below piece of code to get latitude and longitude.Eventhough i am not getting latitude and longitude values. Should i need to do any changes other than this to get latitude and longitude values?
In appdelegate.h:
CLLocationManager *locationManager;
In appdelegate.m:
- (void)applicationDidBecomeActive:(UIApplication *)application{
if (locationManager==nil) {
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
if ([locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
[locationManager requestAlwaysAuthorization];
}
[locationManager startUpdatingLocation];
}
CLLocation *location = [locationManager location];
CLLocationCoordinate2D coordinate = [location coordinate];
NSLog(@" location details %f %f ",locationManager.location.coordinate.latitude, locationManager.location.coordinate.longitude);
}
In Info.plist file
<key>NSLocationAlwaysUsageDescription</key>
<string>This will be used to obtain or track your location.</string>