-
Notifications
You must be signed in to change notification settings - Fork 109
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
iOS additional calls to RouteCalculationFinishedCommand #61
Comments
@TorbenK I was going to report a seperate bug but it's related to this same issue. That issue where I get multiple Routes added to _routes is related to this. It's difficult to reproduce because it's a thread race condition. With each multiple call of MapLoaded, it's calling into UpdateRoutes and then AddRoute which does a delayed _routes.Add when the directions have been calculated. If the timing is right, _routes is cleared after the delayed _routes.Add are called, however sometimes the _routes.Add gets called after a previous UpdateRoutes call clears _routes and this is where I get the multiple routes added which later results in a crash on
Due to there being more than a single item. I know you're short on time at the moment but if you let me know your thoughts about how you wanted to fix it, I could tackle this and put a pull request in. A solution I've come up with is to create a pending list of MKDirections. When the routes list is cleared, this list is also cleared. When the CalculateDirections call returns, it checks to see if it's directions object is still in the list and if not, it just discards the results. |
The |
New: TKCustomMapPin is BindableObject New: All Commands also available as Event New: Possibility to set the anchor position of a pin(Alpha) Fixed: Issue with PinTinColor(iOS) #68 Fixed: Issue with multiple calls to MapLoaded(iOS) #60,#61,#50 Fixed: Issue with missing culture information when converting coordinates to string(Android) #55 Fixed: Double tap no longer triggers MapClicked(iOS) #46 Fixed: Bounds calculation after route calculation is now correct Fixed: Collection events getting unregistered properly Fixed: Issue when route gets removed from collection during calculation Minor bugfixes
So I'm not 100% sure if this is a bug or if it's something you might need to document as a gotcha, but thought I'd make you aware as it seems to have caused some issues in my project:
I would calculate the route and receive my RouteCalculationFinishedCommand events, and I'd wait for the route calculation to be done:
CalculatingRoute is a property I was using to show a progress spinner to show the calculation was busy.
Then when the FitToMapRegions has run, the iOS map animates over to the region and when it's there another MapLoaded event comes through.
This in turn runs:
Which then again goes out and sends out all the RouteCalculationFinishedCommand.
In my code then for every RouteCalculationFinishedCommand, as the Route was already previously calculated, I was then calling FitToMapRegions every single time I got that RouteCalculationFinishedCommand. This then resulted in more calls to MapLoaded depending on race conditions.
I've now fixed this in my code by checking first to ensure I'm expecting that the route hasn't been calculated by using my CalculatingRoute property.
@TorbenK I'll leave it up to you for the fix as I'm not sure which way you want to go about it :)
The text was updated successfully, but these errors were encountered: