---
title: "fetchSharesMatchingObjectIDs:error:"
framework: coredata
role: symbol
role_heading: Instance Method
path: "coredata/nspersistentcloudkitcontainer/fetchsharesmatchingobjectids:error:"
---

# fetchSharesMatchingObjectIDs:error:

Returns a dictionary that contains the share records that CloudKit associates with specified managed object IDs.

## Declaration

```occ
- (NSDictionary<NSManagedObjectID *,CKShare *> *) fetchSharesMatchingObjectIDs:(NSArray<NSManagedObjectID *> *) objectIDs error:(NSError **) error;
```

## Parameters

- `objectIDs`: An array of managed object IDs.
- `error`: On return, an error object that contains information about a problem, or nil if the method successfully fetches the share records.

## Return Value

Return Value A dictionary that uses objectIDs as its keys, and the associated share records as its values.

## Discussion

Discussion If a specified managed object doesn’t belong to a shared record zone, or if Core Data has yet to save the object to iCloud and, therefore, its record zone is unknown, the returned dictionary doesn’t include it. Use a fetched share record to manage its participants and their permissions, or assign data directly to it. A share record is a subclass of CKRecord, which means you can store any data you choose in the underlying record to meet your specific needs. For more information, see CKShare. If you modify a share record, you must save it using the persistUpdatedShare:inPersistentStore:completion: method. note: This method fetches known share records only. It doesn’t attempt to discover additional record zones or share records in any of the persistent container’s CloudKit databases.

## 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)
- [persistUpdatedShare:inPersistentStore:completion:](coredata/nspersistentcloudkitcontainer/persistupdatedshare:inpersistentstore:completion:.md)
- [shareManagedObjects:toShare:completion:](coredata/nspersistentcloudkitcontainer/sharemanagedobjects:toshare:completion:.md)
