Initializes and returns a new attributed string object from the data contained in the given data object.
- iOS 7.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
The data from which to create the string.
Document attributes for interpreting the document contents.
Type Document Attribute
Encoding Document Attribute
NSDefaultare supported option keys. If you pass an empty dictionary, the method examines the data to attempt to determine the appropriate attributes.
Attributes Document Attribute
An in-out dictionary containing document-level attributes described in Document Attributes. May be
NULL, in which case no document attributes are returned.
An in-out variable containing an encountered error, if any.
Returns an initialized attributed string object, or
nil if the data can’t be decoded.
The HTML importer should not be called from a background thread (that is, the
options dictionary includes
NSDocument with a value of
NSHTMLText). It will try to synchronize with the main thread, fail, and time out. Calling it from the main thread works (but can still time out if the HTML contains references to external resources, which should be avoided at all costs). The HTML import mechanism is meant for implementing something like markdown (that is, text styles, colors, and so on), not for general HTML import.