Reputation: 8786
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.
Upvotes: 0
Views: 473
Reputation: 2683
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];
}
Upvotes: 1