0

My app that works fine on iOS 7 doesn't work with the iOS 8 SDK.

CLLocationManager doesn't return a location, and I don't see my app under Settings -> Location Services either. I did a Google search on the issue, but nothing came up. What could be wrong?

fat
  • 6,435
  • 5
  • 44
  • 70
ankit
  • 3,537
  • 1
  • 16
  • 32
  • Are you requesting permission and have you put the appropriate key into your info.plist? http://stackoverflow.com/questions/24062509/location-services-not-working-in-ios-8 – Paulw11 Sep 07 '15 at 08:20
  • No i haven't put key in info.plist. – ankit Sep 07 '15 at 09:49

2 Answers2

0

Add below in your info.plist

Key: NSLocationWhenInUseUsageDescription type: String value:prompt message eg- Requires your current location

Rohit Kumar
  • 877
  • 6
  • 20
0

in ios 8+ u need to request permission [self.locationManager requestWhenInUseAuthorization] for only us3 when in app and [self.locationManager requestAlwaysAuthorization] for always use location

this code perfectly work on ios 8

#pragma mark -
#pragma mark CLLocationManagerDelegate

- (void)startSignificantChangeUpdates
{
    if ([CLLocationManager locationServicesEnabled])
    {
        if (!self.locationManager)
           self.locationManager =  [[CLLocationManager alloc] init];


        self.locationManager.delegate = self;

        // request location when app in use
        [self.locationManager requestWhenInUseAuthorization];
        [self.locationManager startUpdatingLocation];
    }
}



- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
   [self.locationManager stopUpdatingLocation];

    CLGeocoder * geoCoder = [[CLGeocoder alloc] init];
    [geoCoder reverseGeocodeLocation:newLocation completionHandler:^(NSArray *placemarks, NSError *error) {
    for (CLPlacemark * placemark in placemarks) {
        NSString *country = placemark.ISOcountryCode;
        cityName = [placemark locality];
    }
    }];
}