Contents

acceptShareInvitationsFromMetadata:intoPersistentStore:completion:

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

Declaration

- (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 Metadata.

  • persistentStore:

    The persistent store that provides the CloudKit container’s identifier. The store must have the Shared database scope. For more information, see Nspersistentcloudkitcontaineroptions.

  • completion:

    The handler to invoke after you process the specified invitations.

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.

See Also

Sharing Objects