Here is my method which reads content of file. Unfortunately doesn’t work for me. The path to file is correct. What I miss ?
- (IBAction)readFile:(id)sender
{
NSString *str = [NSString stringWithContentsOfFile:@"/Users/joe/text.txt"
encoding:NSUTF32StringEncoding
error:nil
];
NSLog(@"%@", str); //Result is null
}
Try using the built-in functionality of
stringWithContentsOfFile:encoding:error:and give it aNSErrorand you can see exactly whats wrong: