-1

I am new in location services. I have used startMonitoringSignificantLocationChanges and (void)locationManager:(CLLocationManager *)manager didUpdateToLocation: (CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation method but it is not getting called as I change location value. I want to fetch location value whenever user change its location.How should i achieve this? Please help me to resolve. Thanks in advance.

Zalak Patel
  • 1,937
  • 3
  • 26
  • 44

2 Answers2

0

You need to implement "didUpdateLocations" delegate method . Here is sample

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
    NSLog(@"locations : %@",locations.description);

   CLLocation *currentLocation = [locations lastObject];
    NSLog(@"current location : %f %f",currentLocation.coordinate.latitude,currentLocation.coordinate.longitude);



}
user4261201
  • 2,324
  • 19
  • 26
0

In iOS 8 you need to do two extra things to get location working: 1. add one or both of the following keys to your Info.plist file:

NSLocationWhenInUseUsageDescription NSLocationAlwaysUsageDescription

  1. Next you need to request authorization for the corresponding location method, WhenInUse or Background. Use one of these calls:

    [self.locationManager requestWhenInUseAuthorization];

    [self.locationManager requestAlwaysAuthorization];

For details refer following link. http://nevan.net/2014/09/core-location-manager-changes-in-ios-8/

Mike Clark
  • 1,860
  • 14
  • 21