Book Image

Building Apple Watch Projects

By : Stuart Grimshaw
Book Image

Building Apple Watch Projects

By: Stuart Grimshaw

Overview of this book

With Apple’s eagerly anticipated entry into the wearable arena, the field is wide open for a new era of app development. The Apple Watch is one of the most important technologies of our time. This easy-to-understand book takes beginners on a delightful journey of discovering the features available to the developer, right up to the completion of medium-level projects ready for App Store submission. It provides the fastest way to develop real-world apps for the Apple Watch by teaching you the concepts of Watch UI, visual haptic and audio, message and data exchange between watch and phone, Web communication, and finally Visual, haptic as well as audio feedback for users. By the end of this book, you will have developed at least four fully functioning apps for deployment on watchOS 2.
Table of Contents (17 chapters)
Building Apple Watch Projects
About the Author
About the Reviewer

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 and select Open As | Source Code from the contextual menu.


Be careful, don't confuse this with the watch app's identically named Info.plist file!

Add the following entry to the XML text contained in the file, immediately after <dict>, on...