I would like to ask about memory management regarding MKReverseGeocoder , prior to iOS4.3. I used the code below by highlighting MKReverseGeocoder and then releasing it in both reverseGeocoder:didFindPlavemark and reverseGeoCoder:didFailWithError ,
However, with iOS4.3, I get EXC_BAD_ACCESS and it seems to come from a release in reverseGeoCoder:didFailWithError . I would really appreciate it if someone could point me in the right direction, can I use autoRelease, will this mean that geoCoder will be long enough for the delegate to do his job?
// ALLOC & START MKReverseGeocoder *myGeocoder = [[MKReverseGeocoder alloc] initWithCoordinate:[lastGoodLocation coordinate]]; [myGeocoder setDelegate:self]; [myGeocoder start];
.
// DID FIND - (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark { NSLog(@"GEOCODE: didFindPlacemark"); [self createLocation:placemark]; [geocoder release]; }
.
// DID FAIL - (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error { NSLog(@"GEOCODE: didFailWithError"); [self createLocation:nil]; [geocoder release]; }
source share