Question

i m having a problem i have too many pdf files so one by one i m downloading pdf files,

so i put timestamp with my document folder so mypath look like this:

/Users/zee/Library/Application Support/iPhone Simulator/6.0/Applications/10EF6B94-0ECD-484A-

AF5A-D300D8EF55DB/Documents/myPDF.pdf1382698338.78128

but i dont understand why its not opening in UIWebView with timestamp, my below code is

working when i dont put the timestamp.

so how can i open my pdf file that is attached with the timestamp below is my code please

help me out how to solve this problem

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,

 NSUserDomainMask, YES);

    NSString *documentsDirectory = [paths objectAtIndex:0];

    NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"myPDF.pdf"];

    NSURL *targetURL = [NSURL fileURLWithPath:filePath];

    NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];

    [self.webView loadRequest:request];

my filepath is :

/Users/zee/Library/Application Support/iPhone Simulator/6.0/Applications/10EF6B94-0ECD-484A-

AF5A-D300D8EF55DB/Documents/myPDF.pdf1382698338.78128

Please tell me how can i open my pdf file

Was it helpful?

Solution

so i put timestamp with my document folder so mypath look like this:

              /Users/zee/Library/Application Support/iPhone Simulator/6.0/Applications/10EF6B94-0ECD-484A-AF5A-D300D8EF55DB/Documents/myPDF.pdf1382698338.78128

You should try using a different scheme for naming you files, so that the extension is kept unmodified, i.e.:

  ..../myPDF<TIMESTAMP>.pdf

e.g.

  ..../myPDF1382698338.78128.pdf
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top