Instance Method

startMonitoringForRegion:desiredAccuracy:

Starts monitoring the specified region for boundary crossings.

Declaration

- (void)startMonitoringForRegion:(CLRegion *)region desiredAccuracy:(CLLocationAccuracy)accuracy;

Parameters

region

The region object that defines the boundary to monitor. This parameter must not be nil.

accuracy

The distance past the border (measured in meters) at which to generate notifications. You can use this value to prevent the delivery of multiple notifications when the user is close to the border’s edge.

Discussion

You must call this method separately for each region you want to monitor. If an existing region with the same identifier is already being monitored by the app, the old region is replaced by the new one. The regions you add using this method are shared by all location manager objects in your app and stored in the monitoredRegions property.

If you begin monitoring a region and your app is subsequently terminated, the system automatically relaunches it into the background if the region boundary is crossed. In such a case, the options dictionary passed to the application:didFinishLaunchingWithOptions: method of your app delegate contains the key UIApplicationLaunchOptionsLocationKey to indicate that your app was launched because of a location-related event. In addition, creating a new location manager and assigning a delegate results in the delivery of the corresponding region messages. The newly created location manager’s location property also contains the current location even if location services are not enabled.

Region events are delivered to the locationManager:didEnterRegion: and locationManager:didExitRegion: methods of your delegate. If there is an error, the location manager calls the locationManager:monitoringDidFailForRegion:withError: method of your delegate instead.

See Also

Deprecated

locationServicesEnabled

A Boolean value indicating whether location services are enabled on the device.

Deprecated
headingAvailable

A Boolean value indicating whether the location manager is able to generate heading-related events.

Deprecated
purpose

An app-provided string that describes the reason for using location services.

+ regionMonitoringAvailable

Returns a Boolean value indicating whether region monitoring is supported on the current device.

Deprecated
+ regionMonitoringEnabled

Returns a Boolean value indicating whether region monitoring is currently enabled.

Deprecated