---
title: "dictionaryWithContentsOfFile:"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/nsdictionary/dictionarywithcontentsoffile:"
---

# dictionaryWithContentsOfFile:

Creates a dictionary using the keys and values found in a file specified by a given path.

## Declaration

```occ
+ (NSDictionary<id,id> *) dictionaryWithContentsOfFile:(NSString *) path;
```

## Parameters

- `path`: A full or relative pathname. The file identified by path must contain a string representation of a property list whose root object is a dictionary.

## Return Value

Return Value A new dictionary that contains the dictionary at path, or nil if there is a file error or if the contents of the file are an invalid representation of a dictionary.

## Discussion

Discussion The dictionary representation in the file identified by path must contain only property list objects (NSString, NSData, NSDate, NSNumber, NSArray, or NSDictionary objects). For more details, see Property List Programming Guide. The objects contained by this dictionary are immutable, even if the dictionary is mutable.

## See Also

### Creating a Dictionary from an External Source

- [dictionaryWithContentsOfURL:error:](foundation/nsdictionary/dictionarywithcontentsofurl:error:.md)
- [init(contentsOfFile:)](foundation/nsdictionary/init(contentsoffile:).md)
