Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"ERROR: Trying to select an annotation which has not been added" #26

Open
iandundas opened this issue Feb 25, 2014 · 3 comments
Open

"ERROR: Trying to select an annotation which has not been added" #26

iandundas opened this issue Feb 25, 2014 · 3 comments

Comments

@iandundas
Copy link

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?

@BotiKis
Copy link
Owner

BotiKis commented Feb 26, 2014

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.

@iandundas
Copy link
Author

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

  1. "ERROR: Trying to select an annotation which has not been added" #26 (comment)

@ghost
Copy link

ghost commented Apr 29, 2015

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. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants