CLRegion Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/CoreLocation.framework
Availability
Available in iOS 4.0 and later.
Companion guide
Declared in
CLRegion.h
Related sample code

Overview

The CLRegion class defines an abstract area that can be tracked. In iOS, you do not create instances of this class directly; instead, you instantiate subclasses that define specific types of regions. In OS X, you create instances of this class and use them to store the region information. After you create a region, you must register it with a CLLocationManager object. The location manager generates appropriate events whenever the user crosses the boundaries of the region.

To use this class, create an instance of it and use the startMonitoringForRegion: method of a CLLocationManager object to begin monitoring it.

Tasks

Initializing a Region in OS X

Accessing a Region’s Attributes

Configuring Notification Delivery

Hit Testing in a Region

Properties

identifier

The identifier for the region object. (read-only)

@property(readonly, nonatomic) NSString *identifier
Discussion

This is a value that you specify and can use to identify this region inside your application.

Availability
  • Available in iOS 4.0 and later.
Declared In
CLRegion.h

notifyOnEntry

A Boolean indicating that notifications are generated upon entry into the region.

@property (nonatomic, assign) BOOL notifyOnEntry
Discussion

When this property is YES, a device crossing from outside the region to inside the region triggers the delivery of a notification. If the property is NO, a notification is not generated. The default value of this property is YES.

If the app is not running when a boundary crossing occurs, the system launches the app into the background to handle it. Upon launch, your app must configure new location manager and delegate objects to receive the notification. The notification is sent to your delegate’s locationManager:didEnterRegion: method.

Availability
  • Available in iOS 7.0 and later.
Declared In
CLRegion.h

notifyOnExit

A Boolean indicating that notifications are generated upon exit from the region.

@property (nonatomic, assign) BOOL notifyOnExit
Discussion

When this property is YES, a device crossing from inside the region to outside the region triggers the delivery of a notification. If the property is NO, a notification is not generated. The default value of this property is YES.

If the app is not running when a boundary crossing occurs, the system launches the app into the background to handle it. Upon launch, your app must configure new location manager and delegate objects to receive the notification. The notification is sent to your delegate’s locationManager:didExitRegion: method.

Availability
  • Available in iOS 7.0 and later.
Declared In
CLRegion.h

Constants

CLRegionState

Constants that reflect the relationship of the current location to the region boundaries.

typedef {
   CLRegionStateUnknown,
   CLRegionStateInside,
   CLRegionStateOutside
} CLRegionState;
Constants
CLRegionStateUnknown

It is unknown whether the location is inside or outside of the region.

Available in iOS 7.0 and later.

Declared in CLRegion.h.

CLRegionStateInside

The location is inside the given region.

Available in iOS 7.0 and later.

Declared in CLRegion.h.

CLRegionStateOutside

The location is outside of the given region.

Available in iOS 7.0 and later.

Declared in CLRegion.h.