【问题标题】:Creating CGPDFDocument from a URL yields errors in Swift 3?从 URL 创建 CGPDFDocument 会在 Swift 3 中产生错误?
【发布时间】:2016-09-20 21:06:08
【问题描述】:

当我尝试构建时,下面的代码块会产生这两个错误。有人可以帮帮我吗? Xcode 8 在我的项目中使用了它的迁移器,我之前没有看到过这个错误。

    let url = URL(string: "http://www.google.com")!;
    var pdf:CGPDFDocument = CGPDFDocument(url);
  1. error: cannot invoke initializer for type 'CGPDFDocument' with an argument list of type '(URL)'
  2. note: overloads for 'CGPDFDocument' exist with these partially matching parameter lists: (CGDataProvider), (CFURL)

【问题讨论】:

    标签: ios swift core-graphics swift3


    【解决方案1】:

    你好它应该像下面这样。

    let url = URL(string: "http://www.google.com")!
    fileprivate var pdfDoc: CGPDFDocument
    pdfDoc = CGPDFDocument(url as CFURL)!
    

    【讨论】:

      猜你喜欢
      • 2011-03-01
      • 1970-01-01
      • 2020-12-30
      • 2021-01-14
      • 2023-03-18
      • 1970-01-01
      • 2012-04-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多