In a tableview cellForRowAtIndexPath, I do the following:
MapViewController *mapView = [[MapViewController alloc] initWithCoordinates:city.Latitude longitude:city.Longitude];
[cell addSubview:mapView.view];
//[mapView release]; -- will crash here
Calling the last line gives this memory error EXC__BAD _ACCESS”. How do I release the above memory I've alloc'ed wthout crashing?
From above, cell is a UITableViewCell.
MapViewController is a UIViewController that implements MKReverseGeocoderDelegate and MKMapViewDelegate. In MapViewController's init, it allocs an MKMapView. In the controller's viewDidLoad, it adds the mapview to the UIViewController's view:
[self.view addSubview:mapView];