I\'m trying to make an iPhone app, for iOS 7. I\'ve created a txt file in my project, and want to be able to write the text from the txt file, when I push the write-button, writ
You can use the following function :
-(void) writeToTextFile
{
NSArray *paths = NSSearchPathForDirectoriesInDomains
(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *fileName = [NSString stringWithFormat:@"%@/textfile.txt",
documentsDirectory];
NSString *content = @"Your Desired Content";
[content writeToFile:fileName
atomically:NO
encoding:NSStringEncodingConversionAllowLossy
error:nil];
}