CLLocationPushServiceExtension
The interface you adopt in the type that acts as the main entry point for a Location Push Service Extension.
Declaration
protocol CLLocationPushServiceExtension : NSObjectProtocolOverview
A type that adopts the CLLocationPushServiceExtension protocol acts as the entry point to a Location Push Service Extension. You use this type to respond to incoming location push notifications and perform app-specific tasks. For example, you use it to get someone’s current location and send it to your server.
Don’t adopt this protocol in your own custom types. Instead, add a Location Push Service Extension target to your project and modify the type that Xcode provides. To start the delivery of location push notifications, call the startMonitoringLocationPushes(completion:) method to request a unique token from the device. Send that token to your server and use it to generate HTTP requests for APNs to deliver to the device.
When the device receives a location push notification that your server generated, the system loads your app extension and calls its didReceiveLocationPushPayload(_:completion:) method. Use that method to configure a CLLocationManager object and request the person’s current location. Collect the location, encrypt it, and send it back to your server using a custom connection.
Location Push Service Extensions aren’t supported in visionOS. If a compatible iPad or iPhone app contains an app extension of this type, the system doesn’t load it.
For more information about adding the extension to your app, see Creating a location push service extension. For information about how to generate push notifications from your server, see Setting up a remote notification server.