O'Reilly logo

Building Apple Watch Projects by Stuart Grimshaw

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

Getting location data

Now we get to play with some new stuff.

Apple's Core Location framework provides a wealth of functionality around tracking a user's location. Although we will only scratch the surface in this app, you will see that a CLLocation object contains a set of data about the user's geo-coordinates and time-zone, speed of motion, and a time-stamp.

If we wish to access location data, we need to ask permission of the user before we can get a response to our requests to the operating system. And to do this we must first inform the system of our app's need to do so. We do this by adding an entry into the iPhone's Info.plist file.

Modifying the iPhone's Info.plist

The easiest way to do this is to Control-click the file in the project navigator ...

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