“致命错误:init(编码器:)尚未实现”我的iOS应用程序错误

时间:2017-03-06 11:27:45

标签: ios swift

我正在iOS 10 / XCode8.2应用中实现SwiftyCam pod。它是一个自定义的cameraviewcontroller pod,它看起来非常简单易用,但是当我运行它时它会给我这个错误。你们能帮助我吗?我已经查看了其他问题,使用了适用于他们的代码行,但是nada,它们都没有为我工作。

以下是代码:

class randomController: SwiftyCamViewController, SwiftyCamViewControllerDelegate, UIImagePickerControllerDelegate,UINavigationControllerDelegate, CAPSPageMenuDelegate, AVCapturePhotoCaptureDelegate   {
    private var backgroundImage: UIImage

    init(image: UIImage) {
        self.backgroundImage = image
        super.init(nibName: nil, bundle: nil)
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = UIColor.gray
        let backgroundImageView = UIImageView(frame: view.frame)
        backgroundImageView.image = backgroundImage
        view.addSubview(backgroundImageView)
        let cancelButton = UIButton(frame: CGRect(x: 10.0, y: 10.0, width: 30.0, height: 30.0))
        cancelButton.setImage(#imageLiteral(resourceName: "cancel"), for: UIControlState())
        cancelButton.addTarget(self, action: #selector(cancel), for: .touchUpInside)
        view.addSubview(cancelButton)
    }

    func cancel() {
        dismiss(animated: true, completion: nil)
    }
}

0 个答案:

没有答案