07-21-2023, 10:28 PM
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?
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?