<!--
{
  "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/fetchSharesMatchingObjectIDs:error:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPersistentCloudKitContainer(im)fetchSharesMatchingObjectIDs:error:"
  },
  "title" : "fetchSharesMatchingObjectIDs:error:"
}
-->

# fetchSharesMatchingObjectIDs:error:

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

```
- (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

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

## 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 <doc://com.apple.documentation/documentation/CloudKit/CKRecord>, which means you can store any data you choose in the underlying record to meet your specific needs. For more information, see <doc://com.apple.documentation/documentation/CloudKit/CKShare>.

If you modify a share record, you must save it using the [`persistUpdatedShare:inPersistentStore:completion:`](/documentation/CoreData/NSPersistentCloudKitContainer/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.

---

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)