0

我有一个问题我有太多的pdf文件所以我一个接一个地下载pdf文件,

所以我把时间戳放在我的文件夹中,所以 mypath 看起来像这样:

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

AF5A-D300D8EF55DB/Documents/myPDF.pdf1382698338.78128

但我不明白为什么它没有在带有时间戳的 UIWebView 中打开,我下面的代码是

当我不放时间戳时工作。

那么我如何打开附有以下时间戳的pdf文件是我的代码

帮我解决这个问题

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];

我的文件路径是:

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

AF5A-D300D8EF55DB/Documents/myPDF.pdf1382698338.78128

请告诉我如何打开我的pdf文件

4

1 回答 1

0

所以我把时间戳放在我的文件夹中,所以 mypath 看起来像这样:

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

您应该尝试使用不同的方案来命名文件,以便扩展名保持不变,即:

  ..../myPDF<TIMESTAMP>.pdf

例如

  ..../myPDF1382698338.78128.pdf
于 2013-10-25T11:15:43.997 回答