Reputation: 919
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?
Upvotes: 1
Views: 677
Reputation: 385
On a real device, you can simulate only through the debugger, look here:
Simulating a location on Real iOS Device
Upvotes: 1