How Pulsate geofencing works on iOS: requesting location, opting users in and out, and reading stored locations.
Pulsate uses CoreLocation geofencing to trigger location-based campaigns — for example, sending an offer when a customer walks into a store's virtual perimeter. Geofences are defined in the Pulsate CMS; the SDK registers them with iOS and reports enter/exit events.
Requirements
For geofencing to work, the user must grant:
- Precise Location, and
- Allow Always location permission.
Your app must declare NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription in its Info.plist (see Installing the iOS Pulsate SDK).
Starting location
The location permission prompt is shown when you call startLocation() — not at session start. Call it at the point in your flow where you want to ask (ideally right after a priming screen; the SDK requests Always authorization):
pulsateManager.startLocation()
Initialize the SDK in
didFinishLaunchingWithOptionsiOS wakes terminated apps for geofence events via CoreLocation. Pulsate can only handle those wake-ups if the SDK is initialized in
application(_:didFinishLaunchingWithOptions:)with thelaunchOptionsdictionary passed in. See Running the Pulsate SDK.
Opting users in / out of location updates
Use setLocationUpdatesEnabled(_:) on PULPulsateManager to opt a user in or out of Pulsate location updates. By default, all users are opted in.
import PULPulsate
guard let manager = PULPulsateFactory.getDefaultInstance() else { return }
manager.setLocationUpdatesEnabled(true) // Opt in
manager.setLocationUpdatesEnabled(false) // Opt out
Read the current preference with isLocationEnabled():
if manager.isLocationEnabled() {
// Geofencing is active for this user
}
Important
Changes are debounced — the SDK waits up to ~60 seconds before syncing a new preference to the backend.
SDK preference vs. system permission
This toggle is separate from the operating-system location permission. The user must also grant location access to your app (via your
Info.plistusage descriptions and the system prompt) for geofencing to function.
Reading and clearing stored locations (Swift only)
For debugging or auditing, the SDK exposes the locally stored location history:
let locations: [PULLocation] = manager.getAllLocations()
try manager.resetStoredLocations() // clears the local location cache
These two methods are Swift-only (not exposed to Objective-C).
Battery behavior
Since SDK 4.4.0, location was reworked to reduce SDK-driven location updates by more than 90% in typical use: updates are restricted when no geofence is nearby, and geofence-list refreshes wait for meaningful movement (~1 km) between refreshes. Most remaining location activity comes from the iOS Geofencing API itself.

