---
title: "makeDocumentWithContentsOfURL:ofType:"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsdocumentcontroller/makedocumentwithcontentsofurl:oftype:"
---

# makeDocumentWithContentsOfURL:ofType:

Creates and returns a document object for the given document type from the contents of a given URL.

## Declaration

```occ
- (id) makeDocumentWithContentsOfURL:(NSURL *) url ofType:(NSString *) type;
```

## Discussion

Discussion Creates and returns an NSDocument object for document type docType from the contents of aURL. The returned object is not retained. Returns nil if the NSDocument subclass for docType couldn’t be determined or if the object couldn’t be created. This method calls the NSDocument method initWithContentsOfURL:ofType: and is called by openDocumentWithContentsOfURL:display:.

## See Also

### Deprecated Methods

- [documentForFileName:](appkit/nsdocumentcontroller/documentforfilename:.md)
- [fileExtensionsFromType:](appkit/nsdocumentcontroller/fileextensionsfromtype:.md)
- [fileNamesFromRunningOpenPanel](appkit/nsdocumentcontroller/filenamesfromrunningopenpanel.md)
- [makeUntitledDocumentOfType:](appkit/nsdocumentcontroller/makeuntitleddocumentoftype:.md)
- [makeDocumentWithContentsOfFile:ofType:](appkit/nsdocumentcontroller/makedocumentwithcontentsoffile:oftype:.md)
- [openDocumentWithContentsOfFile:display:](appkit/nsdocumentcontroller/opendocumentwithcontentsoffile:display:.md)
- [openDocumentWithContentsOfURL:display:](appkit/nsdocumentcontroller/opendocumentwithcontentsofurl:display:.md)
- [openDocumentWithContentsOfURL:display:error:](appkit/nsdocumentcontroller/opendocumentwithcontentsofurl:display:error:.md)
- [openUntitledDocumentOfType:display:](appkit/nsdocumentcontroller/openuntitleddocumentoftype:display:.md)
- [reopenDocumentForURL:withContentsOfURL:error:](appkit/nsdocumentcontroller/reopendocumentforurl:withcontentsofurl:error:.md)
- [setShouldCreateUI:](appkit/nsdocumentcontroller/setshouldcreateui:.md)
- [shouldCreateUI](appkit/nsdocumentcontroller/shouldcreateui.md)
- [typeFromFileExtension:](appkit/nsdocumentcontroller/typefromfileextension:.md)
