I'm having trouble reading a text file when I use it's relative path name instead of the absolute path.
(See code Below)
I'm not sure why this is not working, but it is the most annoying thing ever!
What am I doing wrong?
// does not work
NSString *fileContents = [NSString stringWithContentsOfFile:@"myFile.txt" encoding:NSUTF8StringEncoding error:NULL];
//works
NSString *fileContents = [NSString stringWithContentsOfFile:@"/Users/myProfile/Desktop/myFile.txt" encoding:NSUTF8StringEncoding error:NULL];
Open in new window
The odd thing is that all my images are loaded with relative path names, and they are all in the same directory as the text file.
For instance the following works correctly
UIImage *image = [UIImage imageNamed:@"myImage.png"]