<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData/NSPersistentStore/setMetadata(_:forPersistentStoreAt:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPersistentStore(cm)setMetadata:forPersistentStoreWithURL:error:"
  },
  "title" : "setMetadata(_:forPersistentStoreAt:)"
}
-->

# setMetadata(_:forPersistentStoreAt:)

Sets the metadata for the store at a given URL.

```
class func setMetadata(_ metadata: [String : Any]?, forPersistentStoreAt url: URL) throws
```

## Parameters

`metadata`

The metadata for the store at `url`.

`url`

The location of the store.

## Discussion

Subclasses must override this method to set metadata appropriately.

---

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)