0

Im working through a weather app tutorial. I am having trouble getting the reverse geocode of the location. It keeps getting the error that is in the title. I get what it is telling me just stuck on how to fix it.

Heres the code snippet:

if (1)
{
    locationManager.delegate = self;
    locationManager.desiredAccuracy = kCLLocationAccuracyBest;
    [locationManager startUpdatingLocation];

    MKReverseGeocoder *geocoder = [[MKReverseGeocoder alloc] initWithCoordinate:locationManager];
    geocoder.delegate = self;
    [geocoder start];
}
else
{
    [self performSelectorInBackground:@selector(showWeatherFor:) withObject:@"95014"];
}

Like I said, Im still learning so an explanation would be nice as to why you did what you did.

1 Answer 1

1

you have to call location getter in the delegate method of CLLocation where you get the gps coordinates. The parameter of MKReverseGeocoder is a CLLocation and not CLLocationManager

# pragma mark LocationGetter Delegate Methods

- (void)newPhysicalLocation:(CLLocation *)location {

    //Geocoder is started only if a valid location is found.
    self.reverseGeocoder = [[[MKReverseGeocoder alloc] initWithCoordinate:location] autorelease];
    reverseGeocoder.delegate = self;
    [reverseGeocoder start];

}
2
  • How do I call the location getter?
    – heinst
    Commented Jul 4, 2012 at 21:36
  • I thought I was starting to get the location with "startUpdatingLocation"
    – heinst
    Commented Jul 4, 2012 at 21:38

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