Search code examples
objective-cioscocoa-touchcore-animationcompiler-warnings

Warning: "No '-renderInContext' method found"


I have this code, and it is working exactly as desired:

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

However, for this line:

[self.layer renderInContext:UIGraphicsGetCurrentContext()];

I am getting the warning (not error):

No '-renderInContext' method found.

How can I have this warning, if in fact the method is working? If I were to simply comment out this line, my code fails; so clearly the line, and thus the method, are in fact working.


Solution

  • You need to add reference to the header file for CALayer - #import <QuartzCore/QuartzCore.h>. You might also need to add the QuartzCore.framework to your project.