0

I am checking my app on iOS 14 beta and In location permission If I select Allow location once it is going to Location failedWithError method and the error object is

Domain=kCLErrorDomain Code=0 "(null)", error.localizedDescription is The operation couldn’t be completed. (kCLErrorDomain error 0.)

-(void)loadFetchLocationDetails
{
    if (locationManager == nil)
        locationManager = [[CLLocationManager alloc] init];
    
    locationManager.delegate = self;
    locationManager.desiredAccuracy = kCLLocationAccuracyBest;
    
    if ([locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
        [locationManager requestWhenInUseAuthorization];
    }
    [locationManager startUpdatingLocation];
    [locationManager startMonitoringSignificantLocationChanges];
}


#pragma mark - CLLocationManagerDelegate Method

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray<CLLocation *> *)locations
{

}

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{

}

Can someone please help me to solve this.

koen
  • 5,383
  • 7
  • 50
  • 89
Ajith Kumar
  • 1,202
  • 1
  • 10
  • 22

1 Answers1

1

It sounds like you forgot to enable "Location Simulation".

Enable it as follows:

  • Go to Product
  • Scheme
  • Edit Scheme
  • Options
  • Allow Location Simulation must be checked, try providing a default location, don't leave it set to "none"

Then restart XCode and the problem should be fixed.