What causes an error code 517 from NSString writeToFile?

I tried both NSStringEncodingConversionAllowLossy and NSUTF16StringEncoding encodings, got same error. Obviously caused by the contents of the string, but what would cause the framework to react with that error code?

Try logging the error's localizedDescription() or other properties for a more detailed description of the problem. Those are going to be user-visible, so don't expect a really detailed diagnosis of the problem, but it will be better than trying to figure out what an arcane error code means.


If that doesn't get you anywhere, try modifying the string or using alternate ones until the error goes away—that will help you figure out the cause of the issue.

Try logging the error's localizedDescription() or other properties for a more detailed description of the problem.

That’s good advice.

Also, for Foundation errors like this one, you can find a list in

<Foundation/FoundationErrors.h>
. The symbolic value for 517 is
NSFileWriteInapplicableStringEncodingError
.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
What causes an error code 517 from NSString writeToFile?
 
 
Q