I have an NSMutableArray of NSStrings, which I want to write to a text file, so that each string has its own line.
Any suggestions?
You can create a full string of your NSMutableArray with
- (NSString *)componentsJoinedByString:(NSString *)separator
Something like
NSString* fullString = [yourArray componentsJoinedByString:@"\n"];
You can then use
- (BOOL)writeToFile:(NSString *)path atomically:(BOOL)useAuxiliaryFile encoding:(NSStringEncoding)enc error:(NSError **)error
on the fullString to write it on disk.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With