O'Reilly logo

iOS Programming Cookbook by Hossam Ghareeb

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Detecting user location

The first thing that a user needs to know when he opens the map is where he is on the map. Getting the user's current location helps him to get an idea of his location, nearby places, and points of interest. To respect the user's privacy, apps can't get the user's current location without the user granting them access to it. In this section, we will see how to ask for permission to access location services and display the current location to the user.

How to do it...

To help display the current location, perform the following steps:

  1. Create a new Xcode project with the Single View Application template and with name the LocationServicesDemo.
  2. In the view controller in storyboard, embed the view controller in Navigation Controller ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required