NSData object containing a representation of the receiver encoded using a given encoding.
- iOS 2.0+
- macOS 10.0+
- tvOS 9.0+
- watchOS 2.0+
- Mac Catalyst 13.0+Beta
A string encoding. For possible values, see
true, then allows characters to be removed or altered in conversion.
NSData object containing a representation of the receiver encoded using
false and the receiver can’t be converted without losing some information (such as accents or case).
true and the receiver can’t be converted without losing some information, some characters may be removed or altered in conversion. For example, in converting a character from
NSASCIIString, the character ‘Á’ becomes ‘A’, losing the accent.
This method creates an external representation (with a byte order marker, if necessary, to indicate endianness) to ensure that the resulting
NSData object can be written out to a file safely. The result of this method, when lossless conversion is made, is the default “plain text” format for encoding and is the recommended way to save or transmit a string object.