<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.13.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 4.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSDictionary/dictionaryWithContentsOfURL:error:",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDictionary(cm)dictionaryWithContentsOfURL:error:"
  },
  "title" : "dictionaryWithContentsOfURL:error:"
}
-->

# dictionaryWithContentsOfURL:error:

Creates a dictionary using the keys and values found in a resource specified by a given URL.

```
+ (NSDictionary<NSString *,id> *) dictionaryWithContentsOfURL:(NSURL *) url error:(NSError **) error;
```

## Parameters

`url`

A URL that identifies a resource containing a string representation of a property list whose root object is a dictionary.

## Return Value

A new dictionary that contains the dictionary at `url`, or `nil` if there is an error or if the contents of the resource are an invalid representation of a dictionary.

## Discussion

The dictionary representation in the file identified by path must contain only property list objects ([`NSString`](/documentation/Foundation/NSString), [`NSData`](/documentation/Foundation/NSData), [`NSDate`](/documentation/Foundation/NSDate), [`NSNumber`](/documentation/Foundation/NSNumber), [`NSArray`](/documentation/Foundation/NSArray), or [`NSDictionary`](/documentation/Foundation/NSDictionary) objects). For more details, see [Property List Programming Guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/PropertyLists/Introduction/Introduction.html#//apple_ref/doc/uid/10000048i). The objects contained by this dictionary are immutable, even if the dictionary is mutable.

---

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)