title: Setting filter value in Core Image is causing a crash. - Swift
body: <p>What I am trying to do is take a screenshot, crop that screenshot, and then to make it look better by apply the CISharpenLuminance filter. The code has all worked fine until I add the filter. When I push the button that does all of this I get this error: "terminating with uncaught exception of type NSException" and a crash error in the first line of the AppDelegate with the message: "Thread 1: signal SIGABRT"</p>
  
  <p>Here is my code:</p>
  
  <pre><code>        //Getting the Image
          UIGraphicsBeginImageContext(view.frame.size)
          view.layer.renderInContext(UIGraphicsGetCurrentContext())
          image = UIGraphicsGetImageFromCurrentImageContext()
          UIGraphicsEndImageContext()
  
          //Cropping the Image
          let rect = CGRectMake(0, 97, 320, 213)
          let cgiImage = image?.CGImage
          let imageBitMap: CGImageRef = CGImageCreateWithImageInRect(cgiImage, rect)
  
  
  
          //Sharpening the Image
          let ciiCroppedImage = CIImage(CGImage: imageBitMap)
  
          let filter = CIFilter(name: "CISharpenLuminance")
          filter.setValue(ciiCroppedImage, forKey: kCIInputImageKey)
          filter.setValue(0.8, forKey: kCIInputIntensityKey)
  
          let context = CIContext(options: nil)
          let cgimg = context.createCGImage(filter.outputImage, fromRect: filter.outputImage.extent())
  
          finalImage = UIImage(CIImage: filter.outputImage)
  </code></pre>
  
  <p>If I comment this line out:
      filter.setValue(0.8, forKey: kCIInputIntensityKey)
  The app doesn't crash, but of course that kind of ruins the point. I am pretty sure that line is the problem, but I could be wrong. image and finalImage are declared as empty variables outside of the button. This is my first time working with Core Image so I don't exactly know what I'm doing, so its very possible this is a simple mistake. Thanks in advance!</p>