0
這是PDF閱讀器的電流迅速代碼必須知道文件和路徑:我的Github PDF閱讀器與我的Swift代碼一起使用Test.pdf文件,但是如何閱讀存儲在Parse數據庫中的pdf文件?
class ViewController: UIViewController , ReaderViewControllerDelegate{ @IBAction func didClickOpenPDF(sender: AnyObject) { let file = NSBundle.mainBundle().pathForResource("Test", ofType: "pdf") let document:ReaderDocument = ReaderDocument.withDocumentFilePath(file, password: nil) print(file) print("DOcument = ", document) if (document != "") { print("not empty") let readerViewController:ReaderViewController = ReaderViewController(readerDocument: document) readerViewController.delegate = self readerViewController.modalTransitionStyle = UIModalTransitionStyle.CrossDissolve readerViewController.modalPresentationStyle = UIModalPresentationStyle.FullScreen [self.presentViewController(readerViewController, animated: true, completion: nil)] } }
- 這是解析數據庫結構:
- 那麼我該如何訪問並閱讀「bookfile」字段並知道路徑目錄? 任何人都可以幫助和提供一些代碼,我可以使用swift-2嗎?謝謝
感謝您的回覆。 – vincent
對不起,我可以檢查如何處理行 如果讓pdfData = pdf數據,因爲我是新來的迅速和解析。我嘗試將pdfData分配給我以前的代碼 let file = NSBundle.mainBundle()。pathForResource(「pdfData」,ofType:「pdf」) let document:ReaderDocument = ReaderDocument.withDocumentFilePath(file,password:nil) 當我打印文件=零和 系統崩潰致命錯誤:意外地發現零,同時在ReaderDOcument行解包可選值。 – vincent
別擔心!我終於找到了一種獲取網址的方法。謝謝 – vincent