Making Your App Location-Aware
Using location-based information in your apps is a way to keep the user connected to the surrounding world. Whether you use this information for practical purposes (such as navigation) or for entertainment, location-based information can improve the overall user experience.
Location-based information in iOS comprises two pieces: location services and maps. Location services are provided by the Core Location framework, which provides Objective-C interfaces for obtaining information about the user’s location and heading. Maps are provided by the Map Kit framework, which supports both the display and annotation of maps similar to those found in the Maps app.
At a Glance
Map and location services provide a way for you to enhance user interactions. By incorporating geographic data into your apps, you can orient the user to the surrounding environment or help the user stay connected to other people nearby.
Location Services Provide a Geographical Context for Apps
Location services is all about mobility and the fact that your app is running on a device that can go anywhere. Knowing the user’s geographic location can help you improve the quality of the information you offer, and in some cases it might even be at the heart of your app. Apps that offer navigation features use location services to monitor the user’s position and generate updates. And many other types of apps use location as a way of connecting nearby users socially.
Heading Information Indicates the User’s Current Orientation
Heading services complement the basic location services by providing more precise information about which way a device is pointed. The most obvious use for this technology is for implementing a compass but this technology is also used to support augmented reality, games, and navigational apps. And even on devices that do not have a magnetometer—the hardware used to get precise heading information—information about the user’s course and speed are still available for apps that need it.
Maps Support Navigation and the Display of Geographically Relevant Content
Maps are a way to visualize geographical data in a way that is easy to understand. The Map Kit framework provides standard views that you can incorporate into your app and use to display information tied to specific geographic points. In addition, this framework provides the means to layer custom information on top of the map and have it scroll along with the rest of the map content.
Routing Apps Provide Directions to the User
A routing app is an app that is able to receive coordinates from the Maps app and use those coordinates to provide point-to-point directions to the user. Apps that provide navigation capabilities can declare themselves as a routing app with minimal additional effort. In addition to driving and walking directions, routing apps can support many other modes of transport, including taxi, airplane, and many public transportation options.
How to Use This Document
You do not have to read this entire document to use each of the technologies. The services provided by the Core Location and Map Kit frameworks are separate and can be used independent of other services. Therefore, the beginning of each chapter introduces the terminology and information you need to understand the corresponding technology followed by examples and task-related steps on how to use it. The only exception is the “Annotating Maps” chapter, which builds on the information presented in the “Displaying Maps” chapter.
For information about the classes of the Core Location framework, see Core Location Framework Reference.
For information about the classes of the Map Kit framework, see Map Kit Framework Reference.
© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-09-19)