首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从URL创建CGPDFDocument会在Swift 3中产生错误吗?

从URL创建CGPDFDocument会在Swift 3中产生错误吗?
EN

Stack Overflow用户
提问于 2016-09-20 21:06:08
回答 1查看 1.7K关注 0票数 2

下面的代码块在我试图构建时会产生这两个错误。有人能帮我吗?Xcode 8在我的项目中使用了它的migrator,我以前从未见过这个错误。

代码语言:javascript
复制
    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)
EN

回答 1

Stack Overflow用户

发布于 2016-09-27 13:37:55

你好,下面应该是这样的。

代码语言:javascript
复制
let url = URL(string: "http://www.google.com")!
fileprivate var pdfDoc: CGPDFDocument
pdfDoc = CGPDFDocument(url as CFURL)!
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39603715

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档