OCMapView
OCMapView copied to clipboard
"ERROR: Trying to select an annotation which has not been added"
ERROR: Trying to select an annotation which has not been added
I'm getting this error with OCMapView, but not MKMapView (which currently works perfectly).
I'm getting it on the following line of code:
[self.mapView selectAnnotation:annotation animated:YES];
annotation
is definitely added to self.mapView already, because it is visible there when iterating over self.mapView.annotations (and comparing pointer references - definitely same annotation object).
This is on iOS7.
Any idea what could be wrong?
Clustered annotations are not really on the map so it can't be selected. I've never thought about this case. One possible fix would be to select the cluster which contains the selected annotation.
Ah that makes sense, ok
On Wed, Feb 26, 2014, at 08:42 AM, Botond Kis wrote:
Clustered annotations are not really on the map so it can't be selected.
I've never thought about this case. One possible fix would be to select the cluster which contains the selected annotation.
—
Reply to this email directly or [1]view it on GitHub. [1131967__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcwODkzMzM3O SwiZGF0YSI6eyJpZCI6MjY0MDI0NTd9fQ==--79cce8853cbb3ee2c638239cbe161953b9 1a302a.gif]
References
- https://github.com/yinkou/OCMapView/issues/26#issuecomment-36099048
I get this error even if clustering is disabled. The annotation with address 0x174e6ba00 is in the list of map annotations. It seems to me though, that it may occur if the annotation is not in the visible map area.
ERROR: Trying to select an annotation which has not been added
Printing description of annotation:
<PingAnnotation: 0x174e6ba00>
po self.mapView.annotations
<__NSArrayI 0x174567080>(
<PingAnnotation: 0x174e71780>,
<PingAnnotation: 0x174e71840>,
<PingAnnotation: 0x174e6b980>,
<PingAnnotation: 0x174e6ba40>,
<PingAnnotation: 0x174e6bb00>,
<PingAnnotation: 0x170e73f80>,
<PingAnnotation: 0x170e74100>,
<PingAnnotation: 0x17127fb00>,
<PingAnnotation: 0x174e6b780>,
<PingAnnotation: 0x174e717c0>,
<PingAnnotation: 0x174e6b9c0>,
<PingAnnotation: 0x174e6ba80>,
<PingAnnotation: 0x170e73780>,
<PingAnnotation: 0x174e6b4c0>,
<PingAnnotation: 0x174e71800>,
<PingAnnotation: 0x174e6b940>,
<PingAnnotation: 0x174e6ba00>,
<PingAnnotation: 0x174e6bac0>,
<PingAnnotation: 0x174c7cec0>,
<PingAnnotation: 0x170e73100>,
<PingAnnotation: 0x170e73b80>
)
EDIT:
Upon further review, I found that the annotation is contained in the aelf.mapView.annotations, but not in the self.mapview.displayedAnnotations, as it is just outside the visible map rect.
Turning on clustering of invisible annotations (clusterInvisibleViews = YES) solved the problem I was experiencing, even do clustering is disable. :)