In the previous two posts, I covered how you can prepare your Android and iOS projects to display maps when using Xamarin Forms, this post is going to build on that previous project that you can find in this GitHub repository, and add the necessary permissions and code needed to display the user's location in the map.

The iOS setup

Let's jump right in, in the project that we built in the two previous posts (or that you just forked from my GitHub repo) that displays a map, we will have to set some permissions so our application can access the user's location. Most of this is handled by the operating system when it identifies that the application wants access to the location, it displays a message to the user, asking for that permission, if it is granted, the app can receive the location, if it is not, the app can't.

But while all of that is handled by the OS, there is one thing that the OS requires from us: the message that it will display to the user when requesting permission.

To set this message, you will have to open the Info.plist file and add the "Location When In Use Usage Description", and/or the "Location Always Usage Description". Both I believe are self-explanatory, but remember which ones you add, since that is the kind of location (when in use or always) that you will have to request from the code.