をクラッシュすることなく、オブジェクトを解放することはできません、私は次の操作を行いますは、テーブルビューのcellForRowAtIndexPathで
MapViewController *mapView = [[MapViewController alloc] initWithCoordinates:city.Latitude longitude:city.Longitude];
[cell addSubview:mapView.view];
//[mapView release]; -- will crash here
は、最後の行は「このメモリエラーEXC__BAD _ACCESSを与えて呼び出します。上記のメモリを解放するにはどうすればいいですか?
上記から、セルはUITableViewCellです。
MapViewControllerは、MKReverseGeocoderDelegateとMKMapViewDelegateを実装するUIViewControllerです。 MapViewControllerのinitでは、MKMapViewを割り当てます。コントローラののviewDidLoadで、それはのUIViewControllerのビューにのMapViewを追加します。
[self.view addSubview:mapView];