为什么我得到'No -renderInContext:找到方法'警告?

P5y*_*cH0 8 iphone ios

我在-renderInContext上收到编译器警告:

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

我在项目框架中有QuartzCore,代码可以工作.如何修复代码以便停止向我发出警告?

我得到的确切警告是

warning: no '-renderInContext:' method found
warning: (Messages without a matching method signature
warning: will be assumed to return 'id' and accept
warning: '...' as arguments.)
Run Code Online (Sandbox Code Playgroud)

aqu*_*qua 33

尝试将Quartz框架导入您的应用程序.

然后加,

#include <QuartzCore/QuartzCore.h>

到您的申请.