<!--
{
  "availability" : [
    "macOS: 10.9.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "XPC",
  "identifier" : "/documentation/XPC/xpc_activity_should_defer(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "XPC"
    ],
    "preciseIdentifier" : "c:@F@xpc_activity_should_defer"
  },
  "title" : "xpc_activity_should_defer(_:)"
}
-->

# xpc_activity_should_defer(_:)

Tests whether to defer an activity.

```
func xpc_activity_should_defer(_ activity: xpc_activity_t) -> Bool
```

## Return Value

Returns true if the activity should be deferred.

## Discussion

Use this function to test whether the criteria of a long-running activity are still satisfied. If not, the system indicates that the application should defer the activity. The application may acknowledge the deferral by calling [`xpc_activity_set_state(_:_:)`](/documentation/XPC/xpc_activity_set_state(_:_:)) with [`XPC_ACTIVITY_STATE_DEFER`](/documentation/XPC/XPC_ACTIVITY_STATE_DEFER). Once deferred, the system places the activity back into the WAIT state and invokes the handler block again at the earliest opportunity when the criteria are once again satisfied.

---

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)