---
title: "Geofencing"
slug: "mapp-engage-ios-sdk-geofencing"
updated: 2026-05-07T09:32:22Z
published: 2026-05-07T09:32:22Z
canonical: "docs.mapp.com/mapp-engage-ios-sdk-geofencing"
---
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mapp.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Geofencing
## Overview
Geofencing in iOS enables apps to monitor specific geographic regions and trigger events or notifications when users enter or exit these areas. This feature is ideal for location-aware marketing or context-sensitive behaviors.
> [!NOTE]
> Note:
>
> This page describes Apple's standard `Core Location` geofencing API. The Mapp Engage iOS SDK does not provide a server-side geofence trigger — geofence regions are defined and monitored entirely in your app. To send a Mapp Engage push from a geofence transition, capture the entry/exit event in your `CLLocationManagerDelegate` and report it to Mapp Engage as a custom attribute or event.
---
## Use Case
1. **Purpose**:
- Trigger actions or notifications based on a user's proximity to a predefined location.
- Deliver personalized, location-specific content to enhance engagement.
2. **Benefits**:
- Increase user interaction with context-aware notifications.
- Provide timely and relevant updates based on user location.
---
## Implementation Details
### Permissions
- Add the required permissions in the `Info.plist` file:
```xml
NSLocationAlwaysAndWhenInUseUsageDescription
We need your location to provide location-based features.
NSLocationWhenInUseUsageDescription
We need your location to provide location-based features.
```
- Request location permissions dynamically in your app:
```swift
locationManager.requestAlwaysAuthorization()
```
### Setup Geofencing
Define a geofence using `CLCircularRegion`:
```swift
let geofenceRegion = CLCircularRegion(center: CLLocationCoordinate2D(latitude: 37.7749, longitude: -122.4194),
radius: 100,
identifier: "GeofenceID")
geofenceRegion.notifyOnEntry = true
geofenceRegion.notifyOnExit = true
```
### Start Monitoring Geofences
Use `CLLocationManager` to monitor the defined geofence:
```swift
locationManager.startMonitoring(for: geofenceRegion)
```
### Handle Geofence Events
Implement the `CLLocationManagerDelegate` methods to handle geofence transitions:
```swift
func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) {
if region is CLCircularRegion {
print("Entered geofence: \(region.identifier)")
}
}
func locationManager(_ manager: CLLocationManager, didExitRegion region: CLRegion) {
if region is CLCircularRegion {
print("Exited geofence: \(region.identifier)")
}
}
```
> [!NOTE]
> Keep in mind:
>
> - Ensure users grant appropriate location permissions (Always or When in Use).
> - Test geofencing accuracy under different conditions to optimize performance.
> - Be mindful of battery usage when monitoring geofences, especially with multiple regions.