You can get didUpdateToLocation updates also in the simulator.
- However you have to include the code on a thread with an active run loop, such
as your application’s main thread. This has the advantage that the GPS has time
to update while the user is clicking around in your APP. :)
- Configure the simulator (tested on 5.1)
You can configure the simulator (Debug > Location), e.g. with your own
location. Visit GoogleMaps for that.
Tip: close simulator to get the last changes applied!
I have added this in the viewDidLoad of main loop:
self.locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];
And the catch of the result:
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation {
// Display location in Log
NSLog(@"Lat= %s Lon=%f", newLocation.coordinate.latitude,
newLocation.coordinate.longitude);
// Stop updating, when one is enough
[locationManager stopUpdatingLocation];
}
Hope this helps.