0

In simulator I set debug->location->custom location latitude and longitude.

Then in code I have:

- (void)updateMap{
    MKCoordinateSpan span;
    span.latitudeDelta = .6;//The amount of north-to-south distance (measured in degrees) to display on the map
    span.longitudeDelta = .6;//The amount of east-to-west distance (measured in degrees) to display for the map region

    MKCoordinateRegion region;
    region.center = _ls.coordinate;
    region.span = span;
    [mapView setRegion:region animated:TRUE];
}

In a different file I obtain @property (nonatomic, readonly) CLLocationCoordinate2D coordinate;

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

    //Get the latitude and longitude location
    CLLocation *lastLocation = [locations lastObject];
    _latitude = [[NSString alloc] initWithFormat:@"%f", lastLocation.coordinate.latitude];
    _longitude = [[NSString alloc] initWithFormat:@"%f", lastLocation.coordinate.longitude];
    _coordinate = lastLocation.coordinate;//manager.location.coordinate;
    }

When I run the app the simulator keeps showing San Francisco. Any ideas why?

wwjdm
  • 2,568
  • 7
  • 32
  • 61

2 Answers2

1

It is the default location for the simulator. To simulate the location use the drop down in the Xcode window to set a location or a "Path" to simulate a movement.

tcarlander
  • 102
  • 8
  • Where is this drop down? I used Simulator Debug drop down and inputed the latitude and longitude for a location, but I get San Francisco still. – wwjdm Apr 15 '13 at 06:37
  • It is in Xcode, above the debug output window see: http://stackoverflow.com/questions/214416/set-the-location-in-iphone-simulator – tcarlander Apr 15 '13 at 06:41
1

Got it working:

(1)I just had to shut down xcode and simulator and reload the program. Now it loads my location.:)

wwjdm
  • 2,568
  • 7
  • 32
  • 61