1

I enabled location simulation from scheme of Xcode checking Allow Location Simulation and selecting sample location from dropdown - New York, NY, USA.

This is my code to fetch place informations from location. currentLocation is got from CLLocationManager and I see the value is exactly got as NewYork location.

- (void) fetchPlacemarks: (CLLocation*) currentLocation
{
  // Reverse-geolocate the current location
  CLGeocoder* geoCoder = [[CLGeocoder alloc] init];
  [geoCoder reverseGeocodeLocation: currentLocation
                 completionHandler: ^(NSArray<CLPlacemark*>* placemarks,
                                      NSError*               error)
   {
      // getting error "The operation couldn’t be completed. (kCLErrorDomain error 8.)"
   }
}

I've tested by Simulator and device with real location(not simulating) but they works like a charm.

Only it doesn't work in device with simulating location. What's wrong here?

1 Answer 1

1

On a real device, you can simulate only through the debugger, look here:

Simulating a location on Real iOS Device

3
  • Yes. I run the app as debug mode. I get my current location exactly as simulated location(New York). Commented Jan 31, 2018 at 13:35
  • Set default location by editing schema (Product->Schema->Edit Schema->Run(left panel)->Options (tab)-> Check the 'Allow Location Simulator') => Select location from drop down => Debug test project on device => Disconnect the data cable and then start testing you desired app Commented Jan 31, 2018 at 13:46
  • No, it's not the answer. Commented Jan 31, 2018 at 13:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.