What does "Receiver type 'CALayer' for instance message is a forward declaration" mean here?

Objective CIosCore AnimationCalayerAutomatic Ref-Counting

Objective C Problem Overview


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 Generation Code

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

The renderInContext line

[captureView.layer renderInContext:pdfContext];
generates the following error.
Automatic Reference Counting issue
Receiver type 'CALayer' for instance message is a forward declaration

Any ideas what is going on here?

Objective C Solutions


Solution 1 - Objective C

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

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

#import <QuartzCore/QuartzCore.h>

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJason GeorgeView Question on Stackoverflow
Solution 1 - Objective CNJonesView Answer on Stackoverflow