/* * CLLocationManager.h * CoreLocation * * Copyright (c) 2008-2010 Apple Inc. All rights reserved. * */ #import #import #import /* * CLDeviceOrientation * * Discussion: * Specifies a physical device orientation, equivalent to UIDeviceOrientation. * */ typedef enum { CLDeviceOrientationUnknown = 0, CLDeviceOrientationPortrait, CLDeviceOrientationPortraitUpsideDown, CLDeviceOrientationLandscapeLeft, CLDeviceOrientationLandscapeRight, CLDeviceOrientationFaceUp, CLDeviceOrientationFaceDown } CLDeviceOrientation; /* * CLAuthorizationStatus * * Discussion: * Represents the current authorization state of the application. * */ typedef enum { kCLAuthorizationStatusNotDetermined = 0, // User has not yet made a choice with regards to this application kCLAuthorizationStatusRestricted, // This application is not authorized to use location services. Due // to active restrictions on location services, the user cannot change // this status, and may not have personally denied authorization kCLAuthorizationStatusDenied, // User has explicitly denied authorization for this application, or // location services are disabled in Settings kCLAuthorizationStatusAuthorized // User has authorized this application to use location services } CLAuthorizationStatus; @class CLLocation; @class CLHeading; @class CLRegion; @protocol CLLocationManagerDelegate; /* * CLLocationManager * * Discussion: * The CLLocationManager object is your entry point to the location service. */ NS_CLASS_AVAILABLE(10_6, 2_0) @interface CLLocationManager : NSObject { @private id _internal; } /* * locationServicesEnabled * * Discussion: * Determines whether the user has location services enabled. * If NO, and you proceed to call other CoreLocation API, user will be prompted with the warning * dialog. You may want to check this property and use location services only when explicitly requested by the user. */ + (BOOL)locationServicesEnabled __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0); /* * headingAvailable * * Discussion: * Returns YES if the device supports the heading service, otherwise NO. */ + (BOOL)headingAvailable __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0); /* * significantLocationChangeMonitoringAvailable * * Discussion: * Returns YES if the device supports significant location change monitoring, otherwise NO. */ + (BOOL)significantLocationChangeMonitoringAvailable __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0); /* * regionMonitoringAvailable * * Discussion: * Determines whether the device supports region monitoring. * If NO, all attempts to monitor regions will fail. */ + (BOOL)regionMonitoringAvailable __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_4_0); /* * regionMonitoringEnabled * * Discussion: * Determines whether region monitoring services are enabled on the device. */ + (BOOL)regionMonitoringEnabled __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_4_0); /* * authorizationStatus * * Discussion: * Returns the current authorization status of the calling application. */ + (CLAuthorizationStatus)authorizationStatus __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_2); @property(assign, nonatomic) id delegate; /* * locationServicesEnabled * * Discussion: * Deprecated. Use +locationServicesEnabled instead. */ @property(readonly, nonatomic) BOOL locationServicesEnabled __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_2_0,__IPHONE_4_0); /* * purpose * * Discussion: * Allows the application to specify what location will be used for in their app. This * will be displayed along with the standard Location permissions dialogs. This property will need to be * set prior to calling startUpdatingLocation. */ @property(copy, nonatomic) NSString *purpose __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_3_2); /* * distanceFilter * * Discussion: * Specifies the minimum update distance in meters. Client will not be notified of movements of less * than the stated value, unless the accuracy has improved. Pass in kCLDistanceFilterNone to be * notified of all movements. By default, kCLDistanceFilterNone is used. */ @property(assign, nonatomic) CLLocationDistance distanceFilter; /* * desiredAccuracy * * Discussion: * The desired location accuracy. The location service will try its best to achieve * your desired accuracy. However, it is not guaranteed. To optimize * power performance, be sure to specify an appropriate accuracy for your usage scenario (eg, * use a large accuracy value when only a coarse location is needed). Use kCLLocationAccuracyBest to * achieve the best possible accuracy. Use kCLLocationAccuracyBestForNavigation for navigation. * By default, kCLLocationAccuracyBest is used. */ @property(assign, nonatomic) CLLocationAccuracy desiredAccuracy; /* * location * * Discussion: * The last location received. Will be nil until a location has been received. */ @property(readonly, nonatomic) CLLocation *location; /* * headingAvailable * * Discussion: * Deprecated. Use +headingAvailable instead. */ @property(readonly, nonatomic) BOOL headingAvailable __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_3_0,__IPHONE_4_0); /* * headingFilter * * Discussion: * Specifies the minimum amount of change in degrees needed for a heading service update. Client will not * be notified of updates less than the stated filter value. Pass in kCLHeadingFilterNone to be * notified of all updates. By default, 1 degree is used. */ @property(assign, nonatomic) CLLocationDegrees headingFilter __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0); /* * headingOrientation * * Discussion: * Specifies a physical device orientation from which heading calculation should be referenced. By default, * CLDeviceOrientationPortrait is used. CLDeviceOrientationUnknown, CLDeviceOrientationFaceUp, and * CLDeviceOrientationFaceDown are ignored. * */ @property(assign, nonatomic) CLDeviceOrientation headingOrientation __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0); /* * heading * * Discussion: * Returns the latest heading update received, or nil if none is available. */ @property(readonly, nonatomic) CLHeading *heading __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0); /* * maximumRegionMonitoringDistance * * Discussion: * the maximum region size, in terms of a distance from a central point, that the framework can support. * Attempts to register a region larger than this will generate a kCLErrorRegionMonitoringFailure. * This value may vary based on the hardware features of the device, as well as on dynamically changing resource constraints. */ @property (readonly, nonatomic) CLLocationDistance maximumRegionMonitoringDistance __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_4_0); /* * monitoredRegions * * Discussion: * Retrieve a set of objects for the regions that are currently being monitored. If any location manager * has been instructed to monitor a region, during this or previous launches of your application, it will * be present in this set. */ @property (readonly, nonatomic) NSSet *monitoredRegions __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_4_0); /* * startUpdatingLocation * * Discussion: * Start updating locations. */ - (void)startUpdatingLocation; /* * stopUpdatingLocation * * Discussion: * Stop updating locations. */ - (void)stopUpdatingLocation; /* * startUpdatingHeading * * Discussion: * Start updating heading. */ - (void)startUpdatingHeading __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0); /* * stopUpdatingHeading * * Discussion: * Stop updating heading. */ - (void)stopUpdatingHeading __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0); /* * dismissHeadingCalibrationDisplay * * Discussion: * Dismiss the heading calibration immediately. */ - (void)dismissHeadingCalibrationDisplay __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0); /* * startMonitoringSignificantLocationChanges * * Discussion: * Start monitoring significant location changes. The behavior of this service is not affected by the desiredAccuracy * or distanceFilter properties. Locations will be delivered through the same delegate callback as the standard * location service. * */ - (void)startMonitoringSignificantLocationChanges __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0); /* * stopMonitoringSignificantLocationChanges * * Discussion: * Stop monitoring significant location changes. * */ - (void)stopMonitoringSignificantLocationChanges __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0); /* * startMonitoringForRegion:desiredAccuracy: * * Discussion: * Start monitoring the specified region. desiredAccuracy represents the distance past the border of the region at * which the application would like to be notified that the region border has been crossed. This is useful to prevent * repeated notifications when the user is on the border of the region. This value will be honored on a best-effort basis, * and may not be respected if desiredAccuracy is large with respect to the size of the region, or if the device is not * capable of providing the precision desired. * * If a region with the same identifier is already being monitored for this application, it will be removed from monitoring. * * This is done asynchronously and may not be immediately reflected in monitoredRegions. */ - (void)startMonitoringForRegion:(CLRegion *)region desiredAccuracy:(CLLocationAccuracy)accuracy __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA,__IPHONE_4_0, __IPHONE_6_0); /* * stopMonitoringForRegion: * * Discussion: * Stop monitoring the specified regio n. It is valid to call stopMonitoringForRegion: for a region that was registered * for monitoring with a different location manager object, during this or previous launches of your application. * * This is done asynchronously and may not be immediately reflected in monitoredRegions. */ - (void)stopMonitoringForRegion:(CLRegion *)region __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_4_0); /* * startMonitoringForRegion: * * Discussion: * Start monitoring the specified region. * * If a region with the same identifier is already being monitored for this application, it will be removed from monitoring. * The region monitoring service will prioritize regions by their sizes, favoring smaller regions over larger regions. * * This is done asynchronously and may not be immediately reflected in monitoredRegions. */ - (void)startMonitoringForRegion:(CLRegion *)region __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_5_0); @end