I've just updated to Xcode 6/iOS 8 SDK and my location service simulation in simulator started not working. It was fine before I updated (I'm currently unable to test on real device). Now, when I select a location for simulation, nothing happens. Delegate's -(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations method is not called. I've restarted Xcode, cleaned the build folder, nothing changed. Why can this happen?
 
    
    - 33,241
- 48
- 191
- 389
5 Answers
Since IOS 8 you need to ask for authorization before starting the CLLocationManager.
Are you calling one of these methods?
[self.locationManager requestWhenInUseAuthorization];  // For foreground access
[self.locationManager requestAlwaysAuthorization]; // For background access
If you have created the project before XCode 6, you probably also need to add the info.plist entry for the new permission.
For more details have a look at this post: Location Services not working in iOS 8
Add Below code in your method
if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) 
{
    [self.locationManager requestWhenInUseAuthorization];
}
Also add Below line at your info.plist file
Key:NSLocationWhenInUseUsageDescription   value:Uses current location  
 
    
    - 3,814
- 4
- 16
- 24
 
    
    - 685
- 5
- 6
- 
                    Anyone having issues with this, I struggled for a while because I was using `[locationManager requestWhenInUseAuthorization];` in the app, but had declared the `NSLocationAlwaysUsageDescription` in the .plist file (note the difference in 'always' and 'when in use'. This solution works, but make sure you **declare the correct usage description type**, either `NSLocationWhenInUseUsageDescription` or `NSLocationAlwaysUsageDescription` (or perhaps both) – 1owk3y May 27 '15 at 00:26
Using Xcode 6.3.1 I have had the location selection stop updating. The fix was to run another project, select "Simulate location > Don't Simulate Location" then build the original project again to resume normal location setting.
 
    
    - 3,274
- 1
- 22
- 30
The other answers are correct, but I also had to reset the simulator before I could get a location, whereas it was working fine on a device. The app was initially installed on that simulator before iOS 8.
To reset your simulator :
- (void)startLocationUpdates{
    geocoder = [[CLGeocoder alloc] init];
    locationManager = [[CLLocationManager alloc] init];
    locationManager.delegate = self;
    locationManager.distanceFilter = kCLDistanceFilterNone;
    locationManager.desiredAccuracy = kCLLocationAccuracyBest;
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
        [locationManager requestWhenInUseAuthorization];
    [locationManager startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
      CLLocation *currentLocation = newLocation;
    if (currentLocation != nil) {
    }
    // Reverse Geocoding
    [geocoder reverseGeocodeLocation:currentLocation completionHandler:^(NSArray *placemarks, NSError *error) {
        if (error == nil && [placemarks count] > 0) {
            placemark = [placemarks lastObject];
                        fullAddress = [NSString stringWithFormat:@"%@,%@,%@,%@",
                           placemark.thoroughfare,
                           placemark.locality,
                           placemark.administrativeArea,
                           placemark.country];
            subtitleLocation = [NSString stringWithFormat:@"PostalCode::%@",
                                 placemark.postalCode];
        } else {
            //  NSLog(@"%@", error.debugDescription);
        }
    } ];
}
- (void)locationManager:(CLLocationManager *)manager
       didFailWithError:(NSError *)error{
    NSLog(@"Cannot find the location.");
}
 
    
    - 132,869
- 46
- 340
- 423
 
    
    - 2,225
- 2
- 24
- 36
 
     
    