I have been trying to append strings to a local resource file but I am having trouble finding a solution. I am trying to create a log file for all the function call in my ap
- (void)log:(NSString *)message {
NSMutableString *string = [[NSMutableString alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/log.txt", [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]]];
if (!string) string = [[NSMutableString alloc] init];
[string appendFormat:@"%@\r\n", message];
[string writeToFile:[NSString stringWithFormat:@"%@/log.txt", [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] atomically:YES encoding:NSUTF8StringEncoding error:nil];
}