Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get 'No -renderInContext: method found' warning?

Tags:

ios

iphone

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.)
like image 814
Tycho Pandelaar Avatar asked Jan 22 '11 20:01

Tycho Pandelaar


2 Answers

Try importing the Quartz framework into your application.

Then add,

#include <QuartzCore/QuartzCore.h>

to your application.

like image 181
aqua Avatar answered Sep 28 '22 06:09

aqua


Do you have QuartzCore.framework in your project?

like image 29
timothy5216 Avatar answered Sep 28 '22 06:09

timothy5216