IOS 8 - Unable to get current location, Error Domain = kCLErrorDomain Code = 0

I have a problem getting my current location. I still get the error:

Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error 0.)"

I already did everything I found here:

Reset content and settings in iOS Simulator (the map application in the simulator shows the correct location).
In Xcode at Product> Scheme> Edit I'm unmarked Allow location (when I check it, it mimics, for example, London).
I added NSLocationWhenInUseUsageDescription to the Info.plist file in my project (the application requests placement permissions, and I can see them in the settings in the iOS simulator).
I have Wi-Fi enabled (for example, I said that location services work fine in Safari, Maps, or even Maps in iOS Simulator).

-(void)viewDidLoad    {
       [super viewDidLoad];
       self.locationManager = [[CLLocationManager alloc] init];

       self.locationManager.delegate = self;
       if(IS_OS_8_OR_LATER){
           NSUInteger code = [CLLocationManager authorizationStatus];
           if (code == kCLAuthorizationStatusNotDetermined && ([self.locationManager    respondsToSelector:@selector(requestWhenInUseAuthorization)])) {

               if([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"]) {
                   [self.locationManager  requestWhenInUseAuthorization];
               } else {
                   NSLog(@"Info.plist does not contain NSLocationAlwaysUsageDescription or    NSLocationWhenInUseUsageDescription");
               }
           }
       }
       [self.locationManager startUpdatingLocation];
       [self.FirstMap setShowsUserLocation:YES];    }

   - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error    {
       NSLog(@"didFailWithError: %@", error);
       UIAlertView *errorAlert = [[UIAlertView alloc]
                                  initWithTitle:@"Error" message:@"Failed to Get Your Location" delegate:nil    cancelButtonTitle:@"OK" otherButtonTitles:nil];
       [errorAlert show];    }

Is there something I forgot about? Thank!

+4
3

, , .

: ( KCLErrorDomain 0)

, , . . , "" → " → " "... , ( ). , , , , . , .

UPDATE

, . "" . , xcode , " gpx ", , . , , , , , ?

+5

iOS 8 , , iOS 7

if CLLocationManager.locationServicesEnabled() {
        if self.manager.respondsToSelector("requestWhenInUseAuthorization") {
            manager.requestWhenInUseAuthorization()
        } else {
            startUpdatingLocation()
        }
    }

http://nshipster.com/core-location-in-ios-8/

+2

. , Xcode " ". a > debug > location > set custom .

+1

All Articles