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

571 Views Asked by At

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?

0

There are 0 best solutions below