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», а изображение в imageView SecondViewcontroller - это фотография, которую я просто выбираю.
Но теперь, после выбора фотографии и нажатия первой кнопки, приложение вылетает на AppDelegate.swift с сообщением об ошибке:
"libc ++ abi.dylib: завершается с необработанным исключением типа NSException
"
Что я должен сделать, чтобы это исправить?