Initializes a data object with the data from the location specified by a given URL.
- iOS 2.0+
- macOS 10.0+
- tvOS 9.0+
- watchOS 2.0+
The URL from which to read data
Use this method to convert
data:// URLs to NSData objects. You can also use it to read short files synchronously. If you need to read potentially large files, initialize an
input, then read the file incrementally.
This initializer may fail and return
nil for various reasons, like bad URLs and file-not-found errors. If you want to handle these errors, use
init(contents instead and catch the error it throws.