iOS Developer Library

Developer

CoreLocation Framework Reference Core Location Constants Reference

Options
Deployment Target:

On This Page
Language:

Core Location Constants Reference

This document describes the constants found in the Core Location framework.

Constants

  • The physical orientation of the device.

    Declaration

    Swift

    enum CLDeviceOrientation : Int32 { case Unknown case Portrait case PortraitUpsideDown case LandscapeLeft case LandscapeRight case FaceUp case FaceDown }

    Objective-C

    typedef enum { CLDeviceOrientationUnknown = 0, CLDeviceOrientationPortrait, CLDeviceOrientationPortraitUpsideDown, CLDeviceOrientationLandscapeLeft, CLDeviceOrientationLandscapeRight, CLDeviceOrientationFaceUp, CLDeviceOrientationFaceDown } CLDeviceOrientation;

    Constants

    • Unknown

      CLDeviceOrientationUnknown

      The orientation is currently not known.

      Available in iOS 4.0 and later.

    • Portrait

      CLDeviceOrientationPortrait

      The device is in portrait mode, with the device held upright and the home button at the bottom.

      Available in iOS 4.0 and later.

    • PortraitUpsideDown

      CLDeviceOrientationPortraitUpsideDown

      The device is in portrait mode but upside down, with the device held upright and the home button at the top.

      Available in iOS 4.0 and later.

    • LandscapeLeft

      CLDeviceOrientationLandscapeLeft

      The device is in landscape mode, with the device held upright and the home button on the right side.

      Available in iOS 4.0 and later.

    • LandscapeRight

      CLDeviceOrientationLandscapeRight

      The device is in landscape mode, with the device held upright and the home button on the left side.

      Available in iOS 4.0 and later.

    • FaceUp

      CLDeviceOrientationFaceUp

      The device is held parallel to the ground with the screen facing upwards.

      Available in iOS 4.0 and later.

    • FaceDown

      CLDeviceOrientationFaceDown

      The device is held parallel to the ground with the screen facing downwards.

      Available in iOS 4.0 and later.

    Import Statement

    Objective-C

    @import CoreLocation;

    Swift

    import CoreLocation

    Availability

    Available in iOS 4.0 and later.

  • The domain for Core Location errors.

    Declaration

    Swift

    let kCLErrorDomain: NSString!

    Objective-C

    extern NSString *const kCLErrorDomain;

    Constants

    • kCLErrorDomain

      kCLErrorDomain

      The domain for Core Location errors. This value is used in the NSError class.

      Available in iOS 2.0 and later.

  • Error codes returned by the location manager object.

    Declaration

    Swift

    enum CLError : Int { case LocationUnknown case Denied case Network case HeadingFailure case RegionMonitoringDenied case RegionMonitoringFailure case RegionMonitoringSetupDelayed case RegionMonitoringResponseDelayed case GeocodeFoundNoResult case GeocodeFoundPartialResult case GeocodeCanceled case DeferredFailed case DeferredNotUpdatingLocation case DeferredAccuracyTooLow case DeferredDistanceFiltered case DeferredCanceled case RangingUnavailable case RangingFailure }

    Objective-C

    typedef enum { kCLErrorLocationUnknown = 0, kCLErrorDenied, kCLErrorNetwork, kCLErrorHeadingFailure, kCLErrorRegionMonitoringDenied, kCLErrorRegionMonitoringFailure, kCLErrorRegionMonitoringSetupDelayed, kCLErrorRegionMonitoringResponseDelayed, kCLErrorGeocodeFoundNoResult, kCLErrorGeocodeFoundPartialResult, kCLErrorGeocodeCanceled, kCLErrorDeferredFailed, kCLErrorDeferredNotUpdatingLocation, kCLErrorDeferredAccuracyTooLow, kCLErrorDeferredDistanceFiltered, kCLErrorDeferredCanceled, kCLErrorRangingUnavailable, kCLErrorRangingFailure, } CLError;

    Constants

    • LocationUnknown

      kCLErrorLocationUnknown

      The location manager was unable to obtain a location value right now.

      Available in iOS 2.0 and later.

    • Denied

      kCLErrorDenied

      Access to the location service was denied by the user.

      Available in iOS 2.0 and later.

    • Network

      kCLErrorNetwork

      The network was unavailable or a network error occurred.

      Available in iOS 3.0 and later.

    • HeadingFailure

      kCLErrorHeadingFailure

      The heading could not be determined.

      Available in iOS 3.0 and later.

    • RegionMonitoringDenied

      kCLErrorRegionMonitoringDenied

      Access to the region monitoring service was denied by the user.

      Available in iOS 4.0 and later.

    • RegionMonitoringFailure

      kCLErrorRegionMonitoringFailure

      A registered region cannot be monitored. Monitoring can fail if the app has exceeded the maximum number of regions that it can monitor simultaneously. Monitoring can also fail if the region’s radius distance is too large.

      Available in iOS 4.0 and later.

    • RegionMonitoringSetupDelayed

      kCLErrorRegionMonitoringSetupDelayed

      Core Location could not initialize the region monitoring feature immediately.

      Available in iOS 4.0 and later.

    • RegionMonitoringResponseDelayed

      kCLErrorRegionMonitoringResponseDelayed

      Core Location will deliver events but they may be delayed. Possible keys in the user information dictionary are described in Error User Info Keys.

      Available in iOS 5.0 and later.

    • GeocodeFoundNoResult

      kCLErrorGeocodeFoundNoResult

      The geocode request yielded no result.

      Available in iOS 5.0 and later.

    • GeocodeFoundPartialResult

      kCLErrorGeocodeFoundPartialResult

      The geocode request yielded a partial result.

      Available in iOS 5.0 and later.

    • GeocodeCanceled

      kCLErrorGeocodeCanceled

      The geocode request was canceled.

      Available in iOS 5.0 and later.

    • DeferredFailed

      kCLErrorDeferredFailed

      The location manager did not enter deferred mode for an unknown reason. This error can occur if GPS is unavailable, not active, or is temporarily interrupted. If you get this error on a device that has GPS hardware, the solution is to try again.

      Available in iOS 6.0 and later.

    • DeferredNotUpdatingLocation

      kCLErrorDeferredNotUpdatingLocation

      The location manager did not enter deferred mode because location updates were already disabled or paused.

      Available in iOS 6.0 and later.

    • DeferredAccuracyTooLow

      kCLErrorDeferredAccuracyTooLow

      Deferred mode is not supported for the requested accuracy. The accuracy must be set to kCLLocationAccuracyBest or kCLLocationAccuracyBestForNavigation.

      Available in iOS 6.0 and later.

    • DeferredDistanceFiltered

      kCLErrorDeferredDistanceFiltered

      Deferred mode does not support distance filters. Set the distance filter to kCLDistanceFilterNone.

      Available in iOS 6.0 and later.

    • DeferredCanceled

      kCLErrorDeferredCanceled

      The request for deferred updates was canceled by your app or by the location manager. This error is returned if you call the disallowDeferredLocationUpdates method or schedule a new deferred update before the previous deferred update request is processed. The location manager may also report this error too. For example, if the app is in the foreground when a new location is determined, the location manager cancels deferred updates and delivers the location data to your app.

      Available in iOS 6.0 and later.

    • RangingUnavailable

      kCLErrorRangingUnavailable

      Ranging is disabled. This might happen if the device is in Airplane mode or if Bluetooth or location services are disabled.

      Available in iOS 7.0 and later.

    • RangingFailure

      kCLErrorRangingFailure

      A general ranging error occurred.

      Available in iOS 7.0 and later.

    Discussion

    Errors are delivered to the delegate using an NSError object.

    Import Statement

    Objective-C

    @import CoreLocation;

    Swift

    import CoreLocation

    Availability

    Available in iOS 2.0 and later.

  • Keys used in error user information dictionaries.

    Declaration

    Swift

    let kCLErrorUserInfoAlternateRegionKey: NSString!

    Objective-C

    extern NSString *const kCLErrorUserInfoAlternateRegionKey;

    Constants

    • kCLErrorUserInfoAlternateRegionKey

      kCLErrorUserInfoAlternateRegionKey

      A key in the user information dictionary of an kCLErrorRegionMonitoringResponseDelayed error whose value is a CLRegion object that the location services can more effectively monitor.

      Available in iOS 5.0 and later.

  • Constant values you can use to specify the accuracy of a location.

    Declaration

    Swift

    let kCLLocationAccuracyBestForNavigation: CLLocationAccuracy let kCLLocationAccuracyBest: CLLocationAccuracy let kCLLocationAccuracyNearestTenMeters: CLLocationAccuracy let kCLLocationAccuracyHundredMeters: CLLocationAccuracy let kCLLocationAccuracyKilometer: CLLocationAccuracy let kCLLocationAccuracyThreeKilometers: CLLocationAccuracy

    Objective-C

    extern const CLLocationAccuracy kCLLocationAccuracyBestForNavigation; extern const CLLocationAccuracy kCLLocationAccuracyBest; extern const CLLocationAccuracy kCLLocationAccuracyNearestTenMeters; extern const CLLocationAccuracy kCLLocationAccuracyHundredMeters; extern const CLLocationAccuracy kCLLocationAccuracyKilometer; extern const CLLocationAccuracy kCLLocationAccuracyThreeKilometers;

    Constants

    • kCLLocationAccuracyBestForNavigation

      kCLLocationAccuracyBestForNavigation

      Use the highest possible accuracy and combine it with additional sensor data. This level of accuracy is intended for use in navigation applications that require precise position information at all times and are intended to be used only while the device is plugged in.

      Available in iOS 4.0 and later.

    • kCLLocationAccuracyBest

      kCLLocationAccuracyBest

      Use the highest-level of accuracy.

      Available in iOS 2.0 and later.

    • kCLLocationAccuracyNearestTenMeters

      kCLLocationAccuracyNearestTenMeters

      Accurate to within ten meters of the desired target.

      Available in iOS 2.0 and later.

    • kCLLocationAccuracyHundredMeters

      kCLLocationAccuracyHundredMeters

      Accurate to within one hundred meters.

      Available in iOS 2.0 and later.

    • kCLLocationAccuracyKilometer

      kCLLocationAccuracyKilometer

      Accurate to the nearest kilometer.

      Available in iOS 2.0 and later.

    • kCLLocationAccuracyThreeKilometers

      kCLLocationAccuracyThreeKilometers

      Accurate to the nearest three kilometers.

      Available in iOS 2.0 and later.

  • Use this constant whenever you want to indicate that a coordinate is invalid.

    Declaration

    Swift

    let kCLLocationCoordinate2DInvalid: CLLocationCoordinate2D

    Objective-C

    const CLLocationCoordinate2D kCLLocationCoordinate2DInvalid

    Constants

    • kCLLocationCoordinate2DInvalid

      kCLLocationCoordinate2DInvalid

      An invalid coordinate value.

      Available in iOS 4.0 and later.

  • This constant indicates the minimum distance required before an event is generated.

    Declaration

    Swift

    let kCLDistanceFilterNone: CLLocationDistance

    Objective-C

    extern const CLLocationDistance kCLDistanceFilterNone;

    Constants

    • kCLDistanceFilterNone

      kCLDistanceFilterNone

      All movements are reported.

      Available in iOS 2.0 and later.

  • This constant indicates the minimum heading change before an event is generated.

    Declaration

    Swift

    let kCLHeadingFilterNone: CLLocationDegrees

    Objective-C

    const CLLocationDegrees kCLHeadingFilterNone;

    Constants

    • kCLHeadingFilterNone

      kCLHeadingFilterNone

      All heading changes are reported.

      Available in iOS 3.0 and later.