Товарищи, выручайте! 2 дня бьюсь над проблемой, после нажатия на кнопку добавить картинку приложение вылетает
Код
func presentAction(configuration: AlertScreenConfiguration) {
let controller = UIAlertController(title: configuration.title,
message: configuration.message,
preferredStyle: .actionSheet)
if configuration.actions.isEmpty {
let action = UIAlertAction(title: "screen.alert.button.ok".localized(),
style: .cancel) { _ in
controller.dismiss(animated: true, completion: nil)
}
controller.addAction(action)
} else {
for actionConfig in configuration.actions {
let action = UIAlertAction(title: actionConfig.title,
style: actionConfig.style.value) { _ in
actionConfig.handler?()
controller.dismiss(animated: true, completion: nil)
}
controller.addAction(action)
}
}
viewController.present(controller, animated: true, completion: nil)
}
После viewController.present(controller, animated: true, completion: nil) вылетает с ошибкой libc++abi.dylib: terminating with uncaught exception of type NSException
Функция при нажатии на кнопку
private func showImagePickerActionSheet() {
let configuration = AlertScreenConfiguration(title: nil, message: nil, style: .actionSheet)
let cameraTitle = "screen.alert.button.camera".localized()
let cameraAction = AlertScreenAction(title: cameraTitle, style: .default) { [weak self] in
guard let strongSelf = self else { return }
strongSelf.imagePickerModule = strongSelf.router.showCameraPicker(moduleOutput: strongSelf, allowsEditing: true)
}
let photoLibraryTitle = "screen.alert.button.photoLibrary".localized()
let photoLibratyAction = AlertScreenAction(title: photoLibraryTitle, style: .default) { [weak self] in
guard let strongSelf = self else { return }
strongSelf.imagePickerModule = strongSelf.router.showGalleryPicker(moduleOutput: strongSelf, allowsEditing: true)
}
let cancelTitle = "button.title.cancel".localized()
let cancelAction = AlertScreenAction(title: cancelTitle, style: .cancel, handler: nil)
configuration.addAction(cameraAction)
configuration.addAction(photoLibratyAction)
configuration.addAction(cancelAction)
router.presentAction(configuration: configuration)
}
Причем, заметил что ошибка только когда запускаю на iPad, на iPhone все нормально работает.