Cocoa CIColorMap滤波器错误

Cocoa CIColorMap滤波器错误,cocoa,Cocoa,尝试使用CIColorMap筛选器,但在应用筛选器时出现运行时错误“[NSImage\u feImage]:无法识别的选择器发送到实例0x100163b10” 在调试器中,我看到在执行applyColorMap的最后一行(返回)时发生RTE。我知道这两个(JPG)文件都存在(imageIn和函数中初始化的文件)。所以知道我为什么会犯这个错误吗 CIColorMap的文档说明:inputGradientImage=一个CIImage类,其属性类型为CIAttributeTypeGradient,显

尝试使用CIColorMap筛选器,但在应用筛选器时出现运行时错误“[NSImage\u feImage]:无法识别的选择器发送到实例0x100163b10”

在调试器中,我看到在执行applyColorMap的最后一行(返回)时发生RTE。我知道这两个(JPG)文件都存在(imageIn和函数中初始化的文件)。所以知道我为什么会犯这个错误吗

CIColorMap的文档说明:inputGradientImage=一个CIImage类,其属性类型为CIAttributeTypeGradient,显示名称为Gradient Image。我的问题是因为我没有识别“属性类型”吗?我该怎么做

我的代码是这样的。。。在主线中:

    CIImage *myResult = [self applyColorMap: inputCIimage];
那么调用的函数是:

- (CIImage*) applyColorMap: (CIImage*)imageIn {
    // Convert imageIn to B&W by using a gradient image half white / half black
    NSString *gradientFP = [[NSString alloc] initWithString:[self myFilepath:
                                                         [NSString stringWithString:@"WB-1x20.jpg"]]];
    NSImage *colormapImage = [[NSImage alloc] initWithContentsOfFile:gradientFP];
    if (colormapImage == nil) {
        NSLog (@"Bailing out.  Gradient image allocation was NOT successful.");
        return nil;
    }
    CIFilter *colorMapFilter = [CIFilter filterWithName:@"CIColorMap"];
    //[colorMapFilter setDefaults];
    [colorMapFilter setValue:imageIn forKey:@"inputImage"];
    [colorMapFilter setValue:colormapImage forKey:@"inputGradientImage"];
    return [colorMapFilter valueForKey:@"outputImage"];  //apply filter and return the new image
}

colormapImage
需要是
CIImage
而不是
NSImage
,IIRC