我要自行下載文件目錄我的PDF文件,然後試圖證明該PDF文件如何在uiwebview中從xcode中的文檔目錄加載pdf文件?
從路徑UIWebView中加載,但它不是隻打開一個空白頁,我不
明白爲什麼它不在uiwebview中加載。
下面是我的代碼,
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathExtension:@".pdf"];
NSURL *url = [NSURL fileURLWithPath:filePath];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.webView loadRequest:request];
,我的文件路徑是:
的NSLog(@ 「文件路徑------- >>%@」,文件路徑);
/用戶/ ZEE /庫/應用程序支持/ iPhone模擬器/ 6.0 /應用/ BD79829B-95FF-4B91-94AD-830C6B1CD31D /文檔/ myPDF.pdf
請告訴我,爲什麼它不工作,應該怎麼最好的解決辦法
感謝
Zeeshan謝赫
您是否在文檔directoy中檢查pdf文件?這是很好的格式和可打開的? – karthika
@ karthika是可以打開的。 –
好吧。嘗試編碼的網址。 – karthika