MKReverseGeocoder delegate location?

Posted by fuzzygoat on Stack Overflow See other posts from Stack Overflow or by fuzzygoat
Published on 2010-05-24T10:48:10Z Indexed on 2010/05/24 10:51 UTC
Read the original article Hit count: 389

Filed under:
|
|

I have a quick question regarding memory management that I am not quite sure about. I currently have a locationManager delegate that calls locationManager:didUpdateToLocation:fromLocation when it resolves the device location. My question is I am looking at adding ReverseGeoCoding after I have obtained the [newLocation coordinate] but am unsure about doing the alloc here, as each time locationManager:didUpdateToLocation:fromLocation gets called I will be alloc-ing a new MKReverseGeoCoder?

// LOCATION
-(void)locationManager:(CLLocationManager *)manager 
   didUpdateToLocation:(CLLocation *)newLocation 
          fromLocation:(CLLocation *)oldLocation {

// GeoCoding:
MKReverseGeocoder *geoCoder = [[MKReverseGeocoder alloc] initWithCoordinate:[newLocation coordinate]];
[geoCoder setDelegate:self];
[geoCoder start];

[self foundLocation];
}

Can anyone point me in the right direction with regards to this? I did try doing the alloc in application:didFinishLaunchingWithOptions: but then realised I did not have access to [newLocation coordinate].

many thanks

gary

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c