Вы сможете существенно сократить свой код, просто используя удобные методы (также делает его более читабельным):
- (void) locationManager:(CLLocationManager *) manager didUpdateToLocation:(CLLocation *) newLocation fromLocation:(CLLocation *) oldLocation {
NSString *lCoordinates = [NSString stringWithFormat:@"%f,%f",newLocation.coordinate.latitude,newLocation.coordinate.longitude];
[self setLocationCoordinates:lCoordinates];
NSString *lat = [NSString stringWithFormat:@"%f,%f", newLocation.coordinate.latitude,newLocation.coordinate.longitude];
[lm stopUpdatingLocation];
NSString *s = [NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/search/json?location=%@&radius=10&sensor=true&key=---MyKey---", lat];
NSLog(s);
AsyncConnectionController * connectionController = [[[AsyncConnectionController alloc] initWithDelegate:self
selSucceeded:@selector(currentLocationConnectionSucceeded:)
selFailed:@selector(currentLocationconnectionFailed:)] autorelease];
NSURL *url = [NSURL urlWithString:s];
[connectionController startRequestForURL:url];
}
OP указывает, что connectionController
является авто-выпуском.