---
title: "persistUpdatedShare:inPersistentStore:completion:"
framework: coredata
role: symbol
role_heading: Instance Method
path: "coredata/nspersistentcloudkitcontainer/persistupdatedshare:inpersistentstore:completion:"
---

# persistUpdatedShare:inPersistentStore:completion:

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

## Declaration

```occ
- (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 doc://com.apple.coredata/documentation/CoreData/NSPersistentCloudKitContainerOptions.
- `completion`: The handler to invoke after the export finishes.

## Discussion

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.

## See Also

### Sharing Objects

- [Accepting Share Invitations in a SwiftUI App](coredata/accepting-share-invitations-in-a-swiftui-app.md)
- [acceptShareInvitationsFromMetadata:intoPersistentStore:completion:](coredata/nspersistentcloudkitcontainer/acceptshareinvitationsfrommetadata:intopersistentstore:completion:.md)
- [fetchParticipantsMatchingLookupInfos:intoPersistentStore:completion:](coredata/nspersistentcloudkitcontainer/fetchparticipantsmatchinglookupinfos:intopersistentstore:completion:.md)
- [fetchSharesInPersistentStore:error:](coredata/nspersistentcloudkitcontainer/fetchsharesinpersistentstore:error:.md)
- [fetchSharesMatchingObjectIDs:error:](coredata/nspersistentcloudkitcontainer/fetchsharesmatchingobjectids:error:.md)
- [shareManagedObjects:toShare:completion:](coredata/nspersistentcloudkitcontainer/sharemanagedobjects:toshare:completion:.md)
