简体   繁体   English

设置CIAdditionCompositing过滤器时,为什么会看到NSUnknownKeyException?

[英]Why am I seeing an NSUnknownKeyException when setting up a CIAdditionCompositing filter?

I'm trying to set up a CIAdditionCompositing filter using the following code: 我正在尝试使用以下代码设置CIAdditionCompositing过滤器:

CIImage *imageOne = [CIImage imageWithCGImage:[UIImage imageNamed:@"picOne"].CGImage];
CIImage *imageTwo = [CIImage imageWithCGImage:[UIImage imageNamed:@"picTwo"].CGImage];

filter = [CIFilter filterWithName:@"CIAdditionCompositing"];
[filter setDefaults];
[filter setValue:imageOne forKey:kCIInputImageKey];
[filter setValue:imageTwo forKey:kCIInputBackgroundImageKey];

CIImage *imageResult  = [filter outputImage];
CGImageRef imageRef = [context createCGImage:imageResult fromRect:imageResult.extent];
_imageView.image = [UIImage imageWithCGImage:imageRef];

and am seeing the following error: 并看到以下错误:

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<__NSCFConstantString 0x2e2d60> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key inputImage.' 由于未捕获的异常'NSUnknownKeyException'而终止应用程序,原因:'[<__ NSCFConstantString 0x2e2d60> setValue:forUndefinedKey:]:此类与键inputImage的键值编码不兼容。

on the line 在线上

[filter setValue:imageOne forKey:kCIInputImageKey];

What am I doing wrong in the setup of this Core Image filter? 在此Core Image滤镜设置中我在做什么错?

Vary strange, this method works... 变怪了,这个方法行得通...

filter = [CIFilter filterWithName:@"CIAdditionCompositing" keysAndValues:kCIInputImageKey, imageOne, kCIInputBackgroundImageKey, imageTwo, nil];

can anyone explain the difference? 谁能解释其中的区别?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么在创建引发NSUnknownKeyException错误的过滤器时使用CITemperatureAndTint的参数关键字? - Why is the Parameter Key for CITemperatureAndTint when creating a filter throwing an NSUnknownKeyException Error? 为什么在启用NSZombie时我会看到所有这些泄漏? - Why am I seeing all these leaks when NSZombie is enabled? 为什么单击按钮时会出现NSUnknownKeyException? - Why do I get NSUnknownKeyException when I click on a button? 在使用Core Plot构建iPhone应用程序时,为什么会看到以下链接器错误? - Why am I seeing the following linker errors when building an iPhone app with Core Plot? 在为Pebble手表进行开发时,为什么在iOS上的-setAppUUID:上看到错误? - Why am I seeing an error on -setAppUUID: on iOS when developing for the Pebble watch? 为什么在 Apple 设备上解码 base64 文本字符串时会看到裁剪的图像? - Why am I seeing a cropped image when decoding a base64 text string on an Apple device? 将Core Data属性从Integer 16更改为String时,为什么会出现此错误? - Why am I seeing this error when changing a Core Data attribute from Integer 16 to String? 为什么我看到黑屏? 我没有分配东西吗? - Why am I seeing a black screen? Did I not alloc something? 为什么我看到有关NSAutoreleasePool不可用的消息警告? - Why am I seeing a message warning about NSAutoreleasePool being unavailable? 加载xib时出现NSUnknownKeyException - NSUnknownKeyException when loading xib
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM