In addition to the required changes from @trojanfoe's answer, your fh
is nil
because the path is wrong. stringWithContentsOfFile:
expects a simple path, not
a file-URL. It should be:
NSString *fh = [NSString stringWithContentsOfFile:@"/Users/Mubanga/Documents/Blender/rough2.txt" encoding:NSUTF8StringEncoding error:nil];
Generally, you should use the error parameter:
NSError *error;
NSString *fh = [NSString stringWithContentsOfFile:@"/Users/Mubanga/Documents/Blender/rough2.txt"
encoding:NSUTF8StringEncoding
error:&error];
if (fh == nil) {
NSLog(@"Could not read file: %@", error);
} else {
// ...
}