The geographic location that the user must reach to enable the delivery of a local notification.
- iOS 10.0+
- watchOS 3.0+
UNLocation object causes the delivery of a notification when the device enters or leaves a specified geographic region. Use this object to specify the region information needed to trigger the notification. Location triggers can fire once or they can fire multiple times.
Apps must request access to location services and must have when-in-use permissions to use this class. To request permission to use location services, call the
request method of
CLLocation before scheduling any location-based triggers.
Always use the
init(region: method to create instances of this class. When configuring the region, use the
notify properties to specify whether you want notifications to be delivered on entry, on exit, or both. Listing 1 shows the creation of a trigger that fires only once when the user’s device enters a circular region with a two kilometer radius.
The system limits the number of location-based triggers that may be scheduled at the same time. Core Location employs heuristics to determine when a boundary crossing occurs and might delay the delivery of boundary crossing events until those heuristics are met. For more information about system limits and the criteria necessary to detect region boundary crossings, see Region Monitoring and iBeacon in Location and Maps Programming Guide.