0

我引用了两个框架 [PDFGenerator 和 PDFKit],它们都包含一个名为 PDFPage 的对象。在 PDFGenerator 框架中,PDFPage 是一个枚举。在 PDFKit 框架中,PDFPage 是一个对象。当我尝试创建 PDFPage Enum 的实例时,出现错误:

在此上下文中,“PDFPage”对于类型查找不明确。

如何指定要实例化的 PDFPage?

下面的简化示例:

import PDFKit

import PDFGenerator

public class VC: UIViewController {
    var page:PDFPage? // <-- This throws the error mentioned above.
}
4

1 回答 1

0

试试这个代码,它将解决错误。

import PDFKit
import PDFGenerator

public class ViewController: UIViewController {
    let page = PDFPage() // <-- This solve the error mentioned above.

    override public func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override public func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
}
于 2018-09-04T06:05:01.963 回答