MKUserTrackingButton turns into a spinner when no permission is given for locations services
Asked Answered
S

0

6

I have added Apple's new MKUserTrackingButton to my app on a map view. It works fine when the user has previously given permission to use location services (e.g. CLAuthorizationStatus.authorizedWhenInUse).

MKUserTrackingButton default

However, when the user has denied permission or the permission status is undetermined, the user tracking button turns into an activity indicator (aka spinner) and never stops spinning.

MKUserTrackingButton spinning without permission

Instead, I would like to show the iOS permission alert like in the Apple Maps app or at least some kind of alert to give the user a hint why it's not working. Naturally, I also want the activity indicator to stops and to turn back into the default "compass needle" icon.

Unfortunately, MKUserTrackingButton is not a sublass of UIButton so I cannot add any targets to it and there seems to be no API to change the visual status of the button.

Any idea how to do this?

Subgroup answered 14/5, 2018 at 13:57 Comment(3)
did you find any solution,Arber
No. I think there isn't any. I tried to come up with some other user-friendly way that ships around the problem, if I remember correctly...Subgroup
I'm just not showing the button, if there is no location in locationManager. locationManager.locationGrimonia

© 2022 - 2024 — McMap. All rights reserved.