Apple の Web サイトで入手できるCurrentAddress サンプルの MapViewController.m ファイルから直接取り出したこのコードを見ています。
- (void)dealloc
{
[reverseGeocoder release];
[mapView release];
[getAddressButton release];
[super dealloc];
}
- (IBAction)reverseGeocodeCurrentLocation
{
self.reverseGeocoder =
[[[MKReverseGeocoder alloc] initWithCoordinate:mapView.userLocation.location.coordinate] autorelease];
reverseGeocoder.delegate = self;
[reverseGeocoder start];
}
オブジェクトを割り当てるときの自動解放の機能は何だろうと思っています。(reverseGeocoder は、retain プロパティを使用して設定された MapViewController クラスの ivar です。) アプリケーションにこれに似たコードがあり、どちらの方法でも機能するようです。