3
votes

Hello,

When I insert this:

UIGraphicsBeginImageContext(imageView.bounds.size);
    [imageView.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

I receive this error on line 2:

Receiver type 'CALayer' for instance message is a forward declaration

I know it has to do with the ARC, but what is an alternative?

1

1 Answers

14
votes

You need to import <QuartzCore/QuartzCore.h>, and add QuartzCore.framework. Once you add this import, CALayer would be fully defined.