【问题标题】:pdfView.document?.write doesn´t work on real device. (Xcode)pdfView.document?.write 在真实设备上不起作用。 (Xcode)
【发布时间】:2020-11-14 14:20:21
【问题描述】:
@IBAction func save(_ sender: Any) {            
    let path = Bundle.main.url (forResource: "SB", withExtension: "pdf")
    pdfView.document?.write(to: path!)      
    guard let url = Bundle.main.url(forResource: "SB", withExtension: "pdf") else {
        print("File loading error!")
        return
    }
    let DOCcontroller = UIDocumentInteractionController(url: url)
    DOCcontroller.delegate = self
    DOCcontroller.presentPreview(animated: true)             
}

    func documentInteractionControllerViewControllerForPreview(_ DOCcontroller: UIDocumentInteractionController) -> UIViewController {
        return self
        }
                 
}

所以我的问题是这适用于 XCodes 模拟,但不适用于真实设备。我在编码方面没有太多经验,这是我的第一个应用程序。

感谢您的帮助:D

【问题讨论】:

    标签: ios swift pdf annotations pdfkit


    【解决方案1】:

    您无法在真实设备上写入捆绑包。查看接受的答案here 有关可以在何处写入文件的更多详细信息和信息。

    【讨论】:

      猜你喜欢
      • 2013-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-04
      • 2020-07-03
      • 2012-07-06
      • 1970-01-01
      相关资源
      最近更新 更多