<!--
{
  "availability" : [
    "iOS: 2.0.0 - 27.2.0",
    "iPadOS: 2.0.0 - 27.2.0",
    "macCatalyst: 13.1.0 - 27.2.0",
    "macOS: 10.0.0 - 27.2.0",
    "tvOS: 9.0.0 - 27.2.0",
    "visionOS: 1.0.0 - 27.2.0",
    "watchOS: 2.0.0 - 27.2.0"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSDictionary/init(contentsOf:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDictionary(im)initWithContentsOfURL:"
  },
  "title" : "init(contentsOf:)"
}
-->

# init(contentsOf:)

Initializes a newly allocated dictionary using the keys and values found at a given URL.

```
convenience init?(contentsOf url: URL)
```

## Parameters

`url`

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

## Return Value

An initialized dictionary—which might be different than the original receiver—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 `url` must contain only property list objects (`NSString`, `NSData`, `NSDate`, `NSNumber`, `NSArray`, or `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.

> Deprecated: Use ``doc://com.apple.foundation/documentation/Foundation/NSDictionary/init(contentsOfURL:error:)`` instead.

---

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)