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

im has a problem, I have too many PDF files, so one by one I upload pdf files,

so I put the timestamp in the document folder, so mypath looks like this:

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

but I don’t understand why it does not open in UIWebView with timestamp, my code is below

works when I do not put a timestamp.

since I can open the pdf file attached with the timestamp below, this is my code, please

help me solve 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 file path 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 a pdf file

0
source share
1 answer

so I put the timestamp in the document folder, so mypath looks 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 files so that the extension is not changed, that is:

  ..../myPDF<TIMESTAMP>.pdf 

eg.

  ..../myPDF1382698338.78128.pdf 
0
source

Source: https://habr.com/ru/post/1437559/


All Articles