为什么在更改kCIInputSharpnessKey时应用程序会丢失?
var filters: [String : Float] = [
kCIInputSharpnessKey : 0.4
]
let filter: CIFilter
init(image: UIImage) {
self.image = image
filter = CIFilter.init(name: "CIColorControls")!
}
func sharpness(n: Float) {
filters[kCIInputSharpnessKey] = n
}
func getImage() -> CIImage? {
let coreImage = CIImage(image: image)
filter.setValue(coreImage, forKey: kCIInputImageKey)
for (key, value) in filters {
filter.setValue(value, forKey: key)
}
return filter.outputImage
}
错误讯息:
***由于未捕获的异常'NSUnknownKeyException'终止应用程序,原因:'[setValue:forUndefinedKey:]:此类不符合键值inputSharpness的键值编码。'