ActionSheet not working iPad

You need to provide a source view or button just before presenting optionMenu since on iPad its a UIPopoverPresentationController, As it says in your error. This just means that your action sheet points to the button letting the user know where it started from.

For example if you’re presenting your optionMenu by tapping on the right navigation bar item. You could do something like this:

optionMenu.popoverPresentationController?.barButtonItem = self.navigationItem.rightBarButtonItem

self.presentViewController(optionMenu, animated: true, completion: nil)

or you could set a view like this:(You just need one of these 2)

optionMenu.popoverPresentationController?.sourceView = yourView

self.presentViewController(optionMenu, animated: true, completion: nil)

Also keep in mind that if you change your UIAlertControllerStyle to Alert instead of action sheet, You wouldn’t need to specify this.
I am sure you must have figured it out but i just wanted to help anyone who comes across this page.

Leave a Comment