<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData/NSPersistentCloudKitContainer/persistUpdatedShare:inPersistentStore:completion:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPersistentCloudKitContainer(im)persistUpdatedShare:inPersistentStore:completion:"
  },
  "title" : "persistUpdatedShare:inPersistentStore:completion:"
}
-->

# persistUpdatedShare:inPersistentStore:completion:

Saves the share record and schedules it for export to iCloud.

```
- (void) persistUpdatedShare:(CKShare *) share inPersistentStore:(NSPersistentStore *) persistentStore completion:(void (^)(CKShare *persistedShare, NSError *persistedShareError)) completion;
```

## Parameters

`share`

The share record to save.

`persistentStore`

The persistent store that provides the database scope and the CloudKit container’s identifier. For more information, see [`NSPersistentCloudKitContainerOptions`](/documentation/CoreData/NSPersistentCloudKitContainerOptions).

`completion`

The handler to invoke after the export finishes.

## Discussion

The `completion` callback returns no value and takes the following parameters:

- The saved share record, or `nil` if the save fails.
- An error object that contains information about a problem, or `nil` if the share record saves successfully.

Core Data saves the share to the persistent store before this method returns, but doesn’t invoke the completion handler until after the export finishes.

> Important:
> Whenever you modify a share record, save the changes using this method to keep the record and the local store’s metadata in sync.

---

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)