gpt4 book ai didi

ios - 使用 pdfkit 显示 pdf

转载 作者:搜寻专家 更新时间:2023-11-01 06:15:24 27 4
gpt4 key购买 nike

我正在尝试加载存储在我的应用程序中的 pdf,这是我拥有的代码

import UIKit
import PDFKit

class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

let pdfView = PDFView(frame: UIScreen.main.bounds)
let url = Bundle.main.url(forResource: "example", withExtension: "pdf")
pdfView.document = PDFDocument(url: url!)
self.view.addSubview(pdfView)
}

When I am running in simulator, I am getting the error that fatal error: unexpectedly found nil while unwrapping an Optional value in the debug are it is showing that url is nil .Any idea how to resolve it? I am running swift 4 and iOS 11 as target

最佳答案

请在文件检查器中点击目标成员下的复选框。

File Inspector - Target Membership

关于ios - 使用 pdfkit 显示 pdf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46397319/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com