Returns a representation of the receiver as a C string in the default C-string encoding.
- iOS 2.0–2.0Deprecated
- macOS 10.0–10.4Deprecated
- Mac Catalyst 13.0–13.0Deprecated
- tvOS 9.0–9.0Deprecated
- watchOS 2.0–2.0Deprecated
The returned C string will be automatically freed just as a returned object would be released; your code should copy the C string or use
get if it needs to store the C string outside of the autorelease context in which the C string is created.
NSCharacter if the receiver can’t be represented in the default C-string encoding without loss of information. Use
can if necessary to check whether a string can be losslessly converted to the default C-string encoding. If it can’t, use
data to get a C-string representation with some loss of information.