---
title: "acceptShareInvitationsFromMetadata:intoPersistentStore:completion:"
framework: coredata
role: symbol
role_heading: Instance Method
path: "coredata/nspersistentcloudkitcontainer/acceptshareinvitationsfrommetadata:intopersistentstore:completion:"
---

# acceptShareInvitationsFromMetadata:intoPersistentStore:completion:

Accepts one or more invitations to participate in sharing using the specified metadata.

## Declaration

```occ
- (void) acceptShareInvitationsFromMetadata:(NSArray<CKShareMetadata *> *) metadata intoPersistentStore:(NSPersistentStore *) persistentStore completion:(void (^)(NSArray<CKShareMetadata *> *acceptedShareMetadatas, NSError *acceptOperationError)) completion;
```

## Parameters

- `metadata`: An array of share metadata. For more information, see doc://com.apple.documentation/documentation/CloudKit/CKShare/Metadata.
- `persistentStore`: The persistent store that provides the CloudKit container’s identifier. The store must have the doc://com.apple.documentation/documentation/CloudKit/CKDatabase/Scope/shared database scope. For more information, see doc://com.apple.coredata/documentation/CoreData/NSPersistentCloudKitContainerOptions.
- `completion`: The handler to invoke after you process the specified invitations.

## Discussion

Discussion The completion handler returns no value and takes the following parameters: An array of accepted share metadata An error object that contains information about a problem, or nil if the method successfully accepts all invitations You typically call this method from your scene delegate’s windowScene(_:userDidAcceptCloudKitShareWith:) method. For SwiftUI apps, there are additional steps you need to complete before you can do this. For more information, see Accepting Share Invitations in a SwiftUI App. note: To be able to accept the share invitations, this method requires an active network connection. It executes a number of CloudKit operations, and imports any shared records into the relevant persistent stores, so it may take some time to complete.

## See Also

### Sharing Objects

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