Search code examples
iosiphoneswiftmapkitapple-maps

iOS How to show in which direction user are going Swift


I am using apple maps in my application and I want to show in which direction the user is facing. Currently in my app it's showing like: enter image description here

But i want:

enter image description here

How can i do this?


Solution

  • Go to Setting > Privacy > Location Services > System Services > Compass Calibration > Enable You will be able to see the direction the user is facing.

    You can take the user to the GPS Settings by doing.

    UIApplication.shared.openURL(URL.init(string: UIApplicationOpenSettingsURLString))
    

    You can prompt the user to enable the compass calibration, but there is no way you can set it without user interaction.