如果我创建一个地图视图的视图控制器,这是我加入到viewDidLoad中的唯一代码:可能的错误
MKPointAnnotation* annotation = [[MKPointAnnotation alloc] init];
annotation.coordinate = CLLocationCoordinate2DMake(-90, -180);
[self.mapView addAnnotation:annotation];
[self.mapView removeAnnotation:annotation];
[annotation release];
我得到的错误:
An instance 0xa126fa0 of class MKPointAnnotation 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:
<NSKeyValueObservationInfo 0xa127df0> (
<NSKeyValueObservance 0xa127c90: Observer: 0xa11c530, Key path: coordinate, Options: <New: NO, Old: NO, Prior: YES> Context: 0x0, Property: 0xa127640>
如果我改变码到这个话,我没有得到任何错误:
MKPointAnnotation* annotation = [[MKPointAnnotation alloc] init];
annotation.coordinate = CLLocationCoordinate2DMake(0, 0);
[self.mapView addAnnotation:annotation];
[self.mapView removeAnnotation:annotation];
[annotation release];
唯一的区别是,(0,0)在地图上,可见一个地方s,(-90,-180)不在视野内。也就是说,我需要平移地图以将坐标(-90,-180)放入视图中。
之前有人遇到过这个错误,或者甚至更好地知道如何解决它?
这不是一个错误,它是一个功能! :) – elp
听起来像一个bug给我。我的直觉是,当它可见时,地图保留一段时间(为了做一个动画淡出?),隐藏错误。 –
@paska如果它是一个非常恼人的功能:) –