Below is what I have
NSString *foofile = @"/Users/alkandari/Library/Application Support/iPhone Simulator/6.1/Applications/8C445026-6387-4E40-B5A3-D1A1680666D6/Documents/ProjacsBODFiles/file_5_21.pdf"
NSURL *url;
if (fileExists) {
url = [NSURL URLWithString:foofile];
NSLog(@"taking local file 1 ... %@==%@", url, foofile);
} else {
url=[NSURL URLWithString:address];
NSLog(@"taking internet file 1... %@", url);
}
When I execute, I get log as below
taking local file 1 ... (null)==/Users/alkandari/Library/Application Support/iPhone Simulator/6.1/Applications/8C445026-6387-4E40-B5A3-D1A1680666D6/Documents/ProjacsBODFiles/file_5_21.pdf
I don't understand why I am getting URL as null. Because of that I am not able to open file.
Any idea why I am getting URL as null above?
You will need to use fileURLWithPath
for path to the localfile system:
NSString *foofile = @"/Users/alkandari/Library/Application Support/iPhone Simulator/6.1/Applications/8C445026-6387-4E40-B5A3-D1A1680666D6/Documents/ProjacsBODFiles/file_5_21.pdf"
NSURL *url;
if (fileExists) {
url = [NSURL fileURLWithPath:foofile];
NSLog(@"taking local file 1 ... %@==%@", url, foofile);
} else {
...
}