[英]Why am I getting an “unrecognized selector sent to class” error for CIFilter?
This code works on an iPad 2 simulator, but not on my physical iPad 2 (which is running on iOS 7.0.6): 此代码可在iPad 2模拟器上运行,但不能在我的物理iPad 2(在iOS 7.0.6上运行)上运行:
var fade = CIFilter(name: "CIExposureAdjust", withInputParameters:["inputEV" : -2.0 ])
The full error message says: 完整的错误消息显示:
[CIFilter filterWithName:withInputParameters:]: unrecognized selector sent to class 0x392d8d9c 2015-07-05 23:12:37.106 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[CIFilter filterWithName:withInputParameters:]: unrecognized selector sent to class 0x392d8d9c' [CIFilter filterWithName:withInputParameters:]:无法识别的选择器发送到类0x392d8d9c 2015-07-05 23:12:37.106 ***由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'+ [CIFilter filterWithName:withInputParameters:]:无法识别选择器发送到类0x392d8d9c'
Check the official documentation of + filterWithName:withInputParameters:
查看+ filterWithName:withInputParameters:
的官方文档+ filterWithName:withInputParameters:
+ filterWithName:withInputParameters:
Availability 可用性
Available in iOS 8.0 and later. 在iOS 8.0和更高版本中可用。
Since your iPad is running on iOS 7, this method is not available, and therefore your app crashes. 由于您的iPad在iOS 7上运行,因此此方法不可用,因此您的应用程序崩溃了。
A few possible solutions: 一些可能的解决方案:
Use - respondsToSelector:
to check if the method exists. 使用- respondsToSelector:
检查该方法是否存在。
Check if the current foundation version number, NSFoundationVersionNumber
is higher than NSFoundationVersionNumber_iOS_7_1
. 检查当前基础版本号NSFoundationVersionNumber
是否高于NSFoundationVersionNumber_iOS_7_1
。
Make iOS 8 a minimum requirement for your app. 将iOS 8设为您的应用程序的最低要求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.