<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CloudKit",
  "identifier" : "/documentation/CloudKit/CKContainer/longLivedOperation(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "CloudKit"
    ],
    "preciseIdentifier" : "s:So11CKContainerC8CloudKitE18longLivedOperation3forSo11CKOperationCSgSS_tYaKF"
  },
  "title" : "longLivedOperation(for:)"
}
-->

# longLivedOperation(for:)

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

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

## Parameters

`operationID`

The operation’s ID.

## Return Value

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

## 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.

---

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)