libc + abi.dylib:以类型为NSException的未捕获异常终止

时间:2019-04-10 12:40:35

标签: ios swift xcode nsexception

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {  
        let alert = SCLAlertView()  
        alert.addButton("A",target:self,selector: #selector(FirstViewController.firstButton))  
        alert.addButton("B",target:self,selector: #selector(FirstViewController.secondButton))  
        self.dismiss(animated: true, completion: {  
            alert.showSuccess(kSuccessTitle,subTitle: kSubtitle1)  
//            self.present(secondViewController,animated: true,completion: nil)  
        })  
    }  
    @objc func firstButton(info: [UIImagePickerController.InfoKey : Any])  
    {  
        let sb = UIStoryboard(name:"Main",bundle: Bundle.main)  
        let secondViewController = sb.instantiateViewController(withIdentifier: "view2") as! SecondViewController  
        secondViewController.infoFromViewOne = info[UIImagePickerController.InfoKey.editedImage] as? UIImage  
        secondViewController.flag = 0  
        self.present(secondViewController,animated: true,completion: nil)  
    }  
    @objc func secondButton()  
    {  
        let sb = UIStoryboard(name:"Main",bundle: Bundle.main)  
        let thirdViewcontroller = sb.instantiateViewController(withIdentifier: "SecondViewController") as! ViewController  
        self.present(thirdViewcontroller,animated: true,completion: nil)  
    }  

这是我的代码, 我希望得到的结果是,当我单击第一个按钮时,页面跳转到“ SecondViewcontroller”,而SecondViewcontroller的imageView中的图像就是我刚刚选择的照片。

但是,现在,选择照片并单击第一个按钮后,该应用程序在AppDelegate.swift崩溃,并显示一条错误消息: “ libc ++ abi.dylib:以类型为NSException的未捕获异常终止”

我该怎么做才能使其正确?

1 个答案:

答案 0 :(得分:-2)

private var infoFromViewOne: UIImage()
    var _infoFromViewOne:UIImage {
    set{ 
         _infoFromViewOne = newValue 
    }
    get{ 
         return _infoFromViewOne
    }
}

如果由于我现在没有确切的代码段而用此删除错误替换它,但是明天可以为您提供。