I have an instance of MkMapView that I’m calling in viewDidLoad for a modal view controller:
mapView = [[MKMapView alloc] init];
mapView.showsUserLocation = YES;
mapView.delegate = self;
I’m just creating it so I can call ReverseGeocoder against it and get a location (placemark). It’s retained by the view and it works fine the first time the view is presented. I re-use the view, called by different items in a UITableView, all presented modally. After the first time it’s called, none of the subsequent calls work. I’m scratching my head and wondering if there’s something up with the release pool.
When the view calls viewDidUnload, I’m setting the delegates to nil:
self.mapView.delegate = nil;
self.reverseGeocoder.delegate = nil;
Any thoughts or something I’m missing?
I would much rather consider creating this object in your
initmethod, and releasing it indeallocrather than worrying about if it exists when the view loads. You can allocate it in yourinitmethod regardless of if you’re displaying it on-screen, and then just add it to your view inviewDidLoadif you choose.