Hey everyone!
Here is the code that xcode says is crashing the app:
func setFilter(action: UIAlertAction) {
// make sure we have a valid image before continuing!
guard currentImage != nil else { return }
// safely read the alert action's title
guard let actionTitle = action.title else { return }
currentFilter = CIFilter(name: actionTitle)
let beginImage = CIImage(image: currentImage)
currentFilter.setValue(beginImage, forKey: kCIInputImageKey)
applyProcessing()
}
(👆🏼 I literally copied/pasta that code from the tutorial just to make sure it wasn't a typo. )
Specifically, xcode is pointing to currentFilter.setValue(beginImage, forKey: kCIInputImageKey)
claiming that it's a Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value
I'm assuming that it's referring to the beginImage
constant but, it works fine with all of the other filters.
I've tried safely unwrapping it with guard let
and if let
but no luck.
I haven't been able to find out why this happens, and why it's only with the GaussianBlue filter. Any help would be much appreciated.
See my repo here.
Thank you!