0Day Forums
What does "Receiver type 'CALayer' for instance message is a forward declaration" mean here? - Printable Version

+- 0Day Forums (https://zeroday.vip)
+-- Forum: Coding (https://zeroday.vip/Forum-Coding)
+--- Forum: Objective-C (https://zeroday.vip/Forum-Objective-C)
+--- Thread: What does "Receiver type 'CALayer' for instance message is a forward declaration" mean here? (/Thread-What-does-quot-Receiver-type-39-CALayer-39-for-instance-message-is-a-forward-declaration-quot-mean-here)



What does "Receiver type 'CALayer' for instance message is a forward declaration" mean here? - corresol305812 - 07-21-2023

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
<pre><code>UIView *captureView;
...
NSMutableData *pdfData = [NSMutableData data];
UIGraphicsBeginPDFContextToData(pdfData, captureView.bounds, nil);
UIGraphicsBeginPDFPage();
CGContextRef pdfContext = UIGraphicsGetCurrentContext();
[captureView.layer renderInContext:pdfContext];
UIGraphicsEndPDFContext();</code></pre>

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

Any ideas what is going on here?


RE: What does "Receiver type 'CALayer' for instance message is a forward declaration" mean here? - comparisons939032 - 07-21-2023

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>