objective-c write in file code example
Example: obj c write file
-(void)write:(NSString *)dir file:(NSString *)ff{
NSArray *paths = NSSearchPathForDirectoriesInDomains
(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *fileName = [NSString stringWithFormat:[@"%@/" stringByAppendingString:dir],
documentsDirectory];
NSString *content = ff;
[content writeToFile:fileName
atomically:NO
encoding:NSStringEncodingConversionAllowLossy
error:nil];
}