简体   繁体   中英

How to read pdf file from document directory with timestamp in iPhone?

im having a problem i have too many pdf files so one by one im 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

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, ie:

  ..../myPDF<TIMESTAMP>.pdf

eg

  ..../myPDF1382698338.78128.pdf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM