8

I get a compiler warning at the -renderInContext:

- (UIImage *) imageFromView:(UIView *)view {
    UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0);
    [view.layer renderInContext:UIGraphicsGetCurrentContext()]; 
    UIImage * img = UIGraphicsGetImageFromCurrentImageContext();    
    UIGraphicsEndImageContext();
    return img; 
}

I have QuartzCore in the project frameworks, and the code works. How do I fix the code so it stops giving me the warning?

The exact warning I get is

warning: no '-renderInContext:' method found
warning: (Messages without a matching method signature
warning: will be assumed to return 'id' and accept
warning: '...' as arguments.)
Tycho Pandelaar
  • 6,500
  • 6
  • 36
  • 66

3 Answers3

33

Try importing the Quartz framework into your application.

Then add,

#include <QuartzCore/QuartzCore.h>

to your application.

aqua
  • 3,014
  • 24
  • 36
  • @Altaveron, Can you elaborate? I suggest opening a separate SO question if you have a specific concern. – aqua Mar 05 '13 at 03:21
2

I suppose it's due to the fact that the CALayer class header is in the QuartzCore framework.

In Xcode, in the Frameworks group, add the QuartzCore framework and it should be all fine.

Then, see my post here on SO for how to include the header files in every source file. Now it's not for Core Data, but for QuartzCore (in the exact same way)

Community
  • 1
  • 1
Joost
  • 10,098
  • 4
  • 51
  • 58
2

Do you have QuartzCore.framework in your project?

timothy5216
  • 270
  • 5
  • 18