Hi I’m trying to use the CIKernel class
I don’t understand why is it that I keep getting these errors:
AdriansFilter.m:23:29: error: receiver ‘CIKernel’ for class message is a forward declaration [4]
AdriansFilter.m:23:28:{23:28-23:62}: error: no known class method for selector ‘kernelsWithString:’ [4]
I’ve tried importing QuartzCore framework but it still doesn’t work. I’m stuck because I really cannot determine what is the real issue here. Could somebody help me please?
my h file looks like this:
#import <Foundation/Foundation.h>
#import <QuartzCore/QuartzCore.h>
@interface AdriansFilter: CIFilter
{
CIImage *inputImage;
CIColor *inputColor;
NSNumber *inputDistance;
NSNumber *inputSlope;
}
@end
my m file looks like this
#import "AdriansFilter.h"
@implementation AdriansFilter
static CIKernel *hazeRemovalKernel = nil;
- (id)init
{
if(hazeRemovalKernel == nil)
{
NSBundle *bundle = [NSBundle bundleForClass: [self class]];
NSString *code = [NSString stringWithContentsOfFile: [bundle
pathForResource: @"MyHazeRemoval"
ofType: @"cikernel"]];
NSArray *kernels = [CIKernel kernelsWithString: code];
hazeRemovalKernel = [kernels objectAtIndex:0];
}
return [super init];
}
@end
You haven’t imported a header where the interface for CIKernel is defined. By searching the Apple developer documentation, I don’t find a CIKernel class reference for iOS. This suggests to me that the CIKernel class is not available on iOS.
In Xcode, click on CIKernel in your source file to put the text cursor there, then open the right column (also known as Utilities) of the Xcode window, then select the quick help inspector tab. If the selected class is available for iOS, you should see documentation for the class and a reference to which header file declares it. When I try this with the CIKernel class selected in an iOS project, I just get “No Quick Help”.