Hi all.
My application crashes whenever I show an action sheet on an iPad, but is fine when running on an iPhone.
Here is the error:
You must provide location information for this popover through the alert controller's popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem. If this information is not known when you present the alert controller, you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.
Here is my action sheet code:
func showSheet() {
let sheet = UIAlertController(title: "Options", message: nil, preferredStyle: .actionSheet)
sheet.addAction(UIAlertAction(title: "Save", style: .default, handler: nil))
sheet.addAction(UIAlertAction(title: "Discard", style: .destructive, handler: nil))
present(sheet, animated: true, completion: nil)
}
Does anybody have a solution?