ビューが消えると、次のメッセージが表示されます。
An instance 0x1c11e0 of class MKAnnotationView was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info:
(コンテキスト: 0x0、プロパティ: 0x1e98d0> )
逆ジオコーディングを定義して開始するコードは次のとおりです。
geo=[[MKReverseGeocoder alloc] initWithCoordinate:droppedAt];
geo.delegate=self;
[geo start];
ビューを閉じる直前に geo.delegate を nil に設定しようとしました。それは簡単すぎるでしょう。私も試しました:
for (id <MKAnnotation> annotation in mvMap.annotations) {
[[mvMap viewForAnnotation:annotation] removeObserver:self forKeyPath:@"selected"];
}
次のようなエラーがスローされます。
*キャッチされない例外 'NSRangeException' が原因でアプリを終了しています。
注釈コードに対する私の見解は次のとおりです。
-(MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
MKAnnotationView *aView;
aView=(MKAnnotationView *) [mapView dequeueReusableAnnotationViewWithIdentifier:annotation.title];
if (aView==nil)
aView=[[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:annotation.title] autorelease];
else
aView.annotation=annotation;
[aView setImage:[UIImage imageNamed:selIcon]];
aView.canShowCallout=TRUE;
aView.draggable=YES;
return aView;
}
ここでボタンを押したり、スイッチを入れたりしながら、スピンインしています。ここで何ができるか考えていますか?