You can try creating NSDatalines with the contents, for example:
NSString *s = @"Hello, world!";
NSData *d = [s dataUsingEncoding:NSUTF8StringEncoding];
You can also directly save NSStrngto a file:
[s writeToFile:@"/my/file/path/file.txt" atomically:NO encoding:NSUTF8StringEncoding error:nil];
NOTE This answer is edited after a note by Ken Thomases.
source
share