<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreLocation",
  "identifier" : "/documentation/CoreLocation/CLLocationPushServiceExtension/serviceExtensionWillTerminate()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Location"
    ],
    "preciseIdentifier" : "c:objc(pl)CLLocationPushServiceExtension(im)serviceExtensionWillTerminate"
  },
  "title" : "serviceExtensionWillTerminate()"
}
-->

# serviceExtensionWillTerminate()

Notifies your app extension that the system is about to terminate the extension because it’s taking too long to complete its task.

```
optional func serviceExtensionWillTerminate()
```

## Discussion

If your [`didReceiveLocationPushPayload(_:completion:)`](/documentation/CoreLocation/CLLocationPushServiceExtension/didReceiveLocationPushPayload(_:completion:)) method takes too long to collect a location and call its completion block, the system calls this method on the main thread. Use this method to execute the completion block from [`didReceiveLocationPushPayload(_:completion:)`](/documentation/CoreLocation/CLLocationPushServiceExtension/didReceiveLocationPushPayload(_:completion:)) as quickly as possible.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)