-
Notifications
You must be signed in to change notification settings - Fork 49
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
assertionFailure("Somehow a cluster contains an unknown annotation item.") #42
Comments
Well, it apparently happens, when the cluster annotation is still in the MKMapView even though one of its member annotations has already been removed. My implementation can therefore not find the original annotation item, since it has already been removed from that dictionary. Unfortunately, I currently do not have the time to dive deeper into this, so you might want to work around the current bug in one of the following ways:
In general, I believe this is actually a MapKit internal bug that we would be working around anyways - so maybe just for clarification, could you please provide a small example project or code snippet that exhibits this issue? |
Thanks for the answer. If I remove the assertionFailure, the app seems to be running, so I guess that's a temporary fix. I am not really sure how I can provide you a small example project or code snippet as there is a lot of logic behind this. To cut a long story short, I have an array of annotation items that I show on the Map. Each annotation item has a variable that I use to filter the array of annotations. If the annotation that was filtered out of the array, was on a cluster annotation, it will throw the assertionFailure. One quick note. My map seems to be lagging after applying the clustering. If I do not include a cluster and show all the annotations, the lag is not as bad. What do you think could be the issue? |
Regarding the lag:
As you can see, without any context, there are many possible issues and I can only really guess what it might be unfortunately. |
|
Okay, then it might simply be the number - have you done this in pure UIKit without issues? Because I would be interested whether this is an issue of MKMapView or this lib. I'm not sure about the filtering of annotation items based on the zoom scale - it could be an improvement, but it might also cause issues instead - would need to try it out. Conceptually, clustering should normally be enough for the map to deal with it, but as I said, I have had issues with too many annotations in the past (when SwiftUI hasn't even been released). What might work for the images is having one instance per image instead of creating them in the annotation closure (not sure, if you already do this though and whether they are backed by an asset, file or data - they might behave differently here). However, this depends on your use case and whether you have a fixed set of images that is known up front. |
No I have not experienced with UIKit. The image I show is one that I have saved in the The code of the annotation item is:
The code of the cluster annotation is:
And this is the Map code:
Maybe these code snippets will help clear things up a bit. |
Yes, it does make it clearer, thank you 😊 I will try to have a deeper look in the next few days, but sadly cannot promise anything. |
Thank you in advance! |
Hello!
I have a filter system in my App, which basically filters the visible annotations on the map. Based on some values, I show the appropriate annotations. I also cluster those annotations if needed. However, I noticed that if the annotation that I remove because of the new filter settings, is still in the clustering group, it throws the error assertionFailure("Somehow a cluster contains an unknown annotation item."). I guess I have to update all my clusters as I update my array of annotations. How do I do that? Thank you!
Yours faithfully,
Iraklis Eleftheriadis
The text was updated successfully, but these errors were encountered: