---
title: "longLivedOperation(for:)"
framework: cloudkit
role: symbol
role_heading: Instance Method
path: "cloudkit/ckcontainer/longlivedoperation(for:)"
---

# longLivedOperation(for:)

Fetches the long-lived operation for the specified operation ID and returns it to an awaiting caller.

## Declaration

```swift
func longLivedOperation(for operationID: CKOperation.ID) async throws -> CKOperation?
```

## Parameters

- `operationID`: The operation’s ID.

## Return Value

Return Value The long-lived operation, or nil if the operation completes, or your app or the system cancels it

## Discussion

Discussion A long-lived operation is one that continues to run after the user closes your app. When a long-lived operation completes, the system calls its completion block to notify you. After setting callback blocks on the returned long-lived operation, and starting the returned long-lived operation on an operation queue, the operation invokes all callbacks made while your app was closed.
