什么“接收者类型'CALayer'例如消息是前向声明”。这意味着什么 [英] What does "Receiver type 'CALayer' for instance message is a forward declaration" mean here?

查看:109
本文介绍了什么“接收者类型'CALayer'例如消息是前向声明”。这意味着什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将一个代码块从iOS4项目移植到iOS5,而我在使用ARC时遇到了一些麻烦。该代码从屏幕截图生成PDF。

I'm porting a block of code from an iOS4 project to iOS5 and I'm having some troubles with ARC. The code generates a PDF from a screen capture.

PDF生成代码

UIView *captureView;
...
NSMutableData *pdfData = [NSMutableData data];
UIGraphicsBeginPDFContextToData(pdfData, captureView.bounds, nil);
UIGraphicsBeginPDFPage();
CGContextRef pdfContext = UIGraphicsGetCurrentContext();
[captureView.layer renderInContext:pdfContext];
UIGraphicsEndPDFContext();

renderInContext行

The renderInContext line

[captureView.layer renderInContext:pdfContext];

生成以下错误。

Automatic Reference Counting issue
Receiver type 'CALayer' for instance message is a forward declaration

这里有什么想法吗?

推荐答案

我能够复制你的问题。这就是我修复它的原因。

I was able to duplicate your problem. This is what fixed it for me.

将QuartzCore.framework添加到您的项目中,并将此行添加到.m文件中。

Add QuartzCore.framework to your project and this line to your .m file.

#import <QuartzCore/QuartzCore.h>

这篇关于什么“接收者类型'CALayer'例如消息是前向声明”。这意味着什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆