Swift:类AppDelegate中的线程1信号SIGABRT:UIResponder,UIApplicationDelegate {

时间:2016-04-07 06:45:28

标签: ios

我是Swift的新手。我正在使用Xcode 7.3,而且我正在制作照片过滤器应用。当我点击"应用过滤器"按钮,应用程序崩溃,出现以下错误:

***由于未捕获的异常终止应用程序' NSUnknownKeyException',原因:' [setValue:forUndefinedKey:]:此类不是键输入角度的键值编码兼容。&# 39;

并突出显示代码

class AppDelegate: UIResponder, UIApplicationDelegate {

在AppDelegate.swift中,带有文本" Swift:线程1信号SIGABRT"。 我不知道这意味着什么。

这是我完成的代码:

import UIKit

class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {

@IBOutlet weak var PhotoLibrary: UIButton!
@IBOutlet weak var Camera: UIButton!
@IBOutlet weak var ImageDisplay: UIImageView!

let context = CIContext(options: nil)

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

@IBAction func PhotoLibraryAction(sender: UIButton) {

    let picker = UIImagePickerController()
    picker.delegate = self
    picker.sourceType = .PhotoLibrary

    presentViewController(picker, animated: true, completion: nil)
}


@IBAction func CameraAction(sender: UIButton) {

    let picker = UIImagePickerController()
    picker.delegate = self
    picker.sourceType = .Camera

    presentViewController(picker, animated: true, completion: nil)
}

//seeing the image after you taken
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
    ImageDisplay.image = info[UIImagePickerControllerOriginalImage] as? UIImage;
    dismissViewControllerAnimated(true, completion: nil)
}

@IBAction func applyFilter(sender: AnyObject) {

    //create image to filter
    let inputImage = CIImage(image: ImageDisplay.image!)

    //Add a color to a filter, 0.00-3.14?
    let selectedColor = [kCIInputAngleKey: (Double(1.24))]

    //Apply a filter to the image
    let filteredImage = inputImage?.imageByApplyingFilter("CIGammaAdjust", withInputParameters: selectedColor)

    let renderedImage = context.createCGImage(filteredImage!, fromRect: (filteredImage?.extent)!)

    //pass the final image to the image view
    ImageDisplay.image = UIImage(CGImage: renderedImage)
}
}

如果您需要更多信息,请回复我。 在此先感谢!!!!

0 个答案:

没有答案