Framework

Core Location

Obtain the geographic location and orientation of a device.

Overview

Core Location provides services for determining a device’s geographic location, altitude, orientation, or position relative to a nearby iBeacon. The framework uses all available onboard hardware, including Wi-Fi, GPS, Bluetooth, magnetometer, barometer, and cellular hardware to gather data.

The first time that your app requests authorization, its authorization status is indeterminate and the system prompts the user to grant or deny the request (as shown in Figure 1). The system records the user's response and does not display this panel upon subsequent requests.

Figure 1

Requesting authorization to use location services

Requesting authorization to use location services

After requesting permission and determining whether services are available, you start most services using the CLLocationManager object and receive the results in your associated delegate object.

Topics

First Steps

Before gathering location data, you must ask for permission to use location services and determine the availability of those services on the current device.

Choosing the Authorization Level for Location Services

Choose the appropriate level of access to location data for your app.

Determining the Availability of Location Services

Determine which location services are active and available on the user's device.

CLLocationManager

The object that you use to start and stop the delivery of location-related events to your app.

CLLocationManagerDelegate

The methods that you use to receive events from an associated location manager object.

Location Updates

Getting the User's Location

Learn how to receive location data in your app.

CLLocation

The latitude, longitude, and course information reported by the system.

CLLocationCoordinate2D

The latitude and longitude associated with a location, specified using the WGS 84 reference frame.

CLFloor

The floor of a building on which the user's device is located.

CLVisit

Information about the user's location during a specific period of time.

Region Monitoring

Configure geofences and receive notifications when the user's device crosses the fence's boundaries.

Monitoring the User's Proximity to Geographic Regions

Use region monitoring to determine when the user enters or leaves a geographic region.

CLCircularRegion

A circular geographic region, specified as a center point and radius.

CLRegion

An area that can be monitored.

iBeacon

Determining the Proximity to an iBeacon

Learn how to detect beacons and determine the relative distance to them.

Turning an iOS Device into an iBeacon

Learn how to broadcast iBeacon signals from an iOS device.

CLBeacon

Information about a detected iBeacon and the relative distance to it.

CLBeaconRegion

A region used to detect iBeacon hardware.

Compass Headings

Determine the device's orientation relative to magnetic or true north.

Getting Heading and Course Information

Use a device's orientation and course information for navigation.

CLHeading

The azimuth (orientation) of the user's device, relative to true or magnetic north.

Geocoding

Converting Between Coordinates and User-Friendly Place Names

Convert between a latitude/longitude pair and a more user-friendly description of that location.

CLGeocoder

An interface for converting between geographic coordinates and place names.

CLPlacemark

A user-friendly description of a geographic coordinate, often containing the name of the place, its address, and other relevant information.

Errors

CLError

Error codes returned by the location manager object.

kCLErrorUserInfoAlternateRegionKey

A key in the user information dictionary of an error relating to a delayed region monitoring response.

kCLErrorDomain

The domain for Core Location errors.

See Also