Предварительный просмотр RPPreview не будет отображаться на ipad
Я пытаюсь использовать RPPreview, чтобы позволить пользователям записывать приложение. Он отлично работает в iPhone, но выдает ошибку:
NSGenericException', reason: 'UIPopoverPresentationController (<UIPopoverPresentationController: 0x13bd24760>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.'
Чего мне не хватает в коде iPad? Как бы я включил sourceView и sourceRect на iPad? Код ниже.
let alert = UIAlertController(title: "Recording Finished", message: "Would you like to edit or delete your recording?", preferredStyle: .alert)
let deleteAction = UIAlertAction(title: "Delete", style: .destructive, handler: { (action: UIAlertAction) in
self.recorder.discardRecording(handler: { () -> Void in
print("Recording suffessfully deleted.")
})
})
let editAction = UIAlertAction(title: "Edit", style: .default, handler: { (action: UIAlertAction) -> Void in
preview?.previewControllerDelegate = self
self.present(preview!, animated: true, completion: nil)
})
alert.addAction(editAction)
alert.addAction(deleteAction)
self.present(alert, animated: true, completion: nil)
self.isRecording = false
Спасибо за любую помощь или совет