可能在MKMapView中的错误

如果我用地图视图创build一个ViewController,并且这是我添加到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)在地图中可见,其中as,(-90,-180)不在视图中。 也就是说,我需要平移地图以将坐标(-90,-180)放到视图中。

任何人遇到过这个错误,甚至更好的知道如何解决它?

经过一些更多的testing,我确信这是一个在MKMapView中的错误。 我只是通过添加可见区域中的注释来解决这个问题。 更多的工作,但至less它不会崩溃我的应用程序:)