I am currently trying to write to a file using the following code:
NSString *state = @"Oklahoma";
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"StatesVisited" ofType:@"txt"];
NSFileHandle *filehandle = [NSFileHandle fileHandleForWritingAtPath:filepath];
[filehandle seekToEndOfFile];
[filehandle writeData:[state dataUsingEncoding:NSUTF8StringEncoding]];
[filehandle closeFile];
From what I can tell, this should work. I have been able to read from the file using the same filepath.
When I run this code, and open my text file nothing exists.