iPad
ActionSheet
iOS development
bug fix
troubleshooting

ActionSheet not working iPad

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

On iPad, an action sheet is presented as a popover, not as the full-width bottom sheet style users are used to on iPhone. That means if you use UIAlertController with .actionSheet and do not provide a presentation anchor, it often fails to appear correctly or crashes with a popover presentation error.

Use UIAlertController, Not UIActionSheet

UIActionSheet is legacy API. Modern code should use UIAlertController.

swift
let alert = UIAlertController(title: "Choose", message: nil, preferredStyle: .actionSheet)
alert.addAction(UIAlertAction(title: "Take Photo", style: .default))
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel))

That is only half the solution on iPad.

Set the Popover Anchor on iPad

For iPad presentation, configure popoverPresentationController.

swift
1if let popover = alert.popoverPresentationController {
2    popover.sourceView = button
3    popover.sourceRect = button.bounds
4}
5
6present(alert, animated: true)

This tells UIKit where the popover should originate. Without it, the system does not know where to place the action sheet in the larger iPad layout.

Bar Button Item Variant

If the action sheet is triggered from a navigation bar button, use barButtonItem instead.

swift
1if let popover = alert.popoverPresentationController {
2    popover.barButtonItem = navigationItem.rightBarButtonItem
3}
4
5present(alert, animated: true)

This is the cleanest setup when the trigger lives in the navigation bar rather than in the content view.

Why It Works on iPhone but Not iPad

The iPhone layout model hides this issue because the action sheet can simply slide up from the bottom. On iPad, UIKit uses a popover-style presentation model and needs a source anchor.

That is why code that appears fine on iPhone can fail immediately on iPad without any other logic differences.

Test the Presentation Context

If the action sheet still does not appear correctly, also verify:

  • the presenting view controller is actually visible
  • the anchor view is not nil
  • the anchor rect is sensible
  • the presentation is happening on the main thread

The anchor is the most common problem, but it is not the only one.

Test the Trigger You Actually Use

If the action sheet is launched from several places in the UI, make sure each trigger provides a valid anchor. A configuration that works for one button may fail for another if the popover source is wired only for the original presentation path.

Rotation and Layout Can Affect the Anchor

If the source view moves or resizes between layout passes, a stale source rect can also lead to odd presentation behavior. Using the current button bounds or the current bar button item at the moment of presentation is safer than caching geometry too early.

A small presentation detail on iPad is enough to make otherwise-correct action-sheet code fail.

Testing on the actual iPad presentation path is the only reliable way to confirm the popover configuration is complete.

That is why this class of bug often survives simulator checks until someone tests the exact iPad interaction path the feature uses in production.

In other words, iPad action-sheet bugs are usually presentation-configuration bugs, not action-handler bugs.

Once the anchor is configured correctly, the same action list logic usually works without any other iPad-specific changes.

Common Pitfalls

  • Using deprecated UIActionSheet patterns in modern iOS code.
  • Presenting an action sheet on iPad without configuring popoverPresentationController.
  • Setting neither sourceView plus sourceRect nor barButtonItem.
  • Testing only on iPhone and assuming the presentation will behave the same on iPad.
  • Trying to present from a view controller that is not actually in the active presentation hierarchy.

Summary

  • On iPad, an action sheet is really a popover-backed presentation.
  • Use UIAlertController with .actionSheet, not legacy UIActionSheet.
  • Set sourceView plus sourceRect or barButtonItem before presenting.
  • iPhone behavior does not prove the iPad presentation is configured correctly.
  • Most iPad action-sheet failures come from missing popover anchors.

Course illustration
Course illustration

All Rights Reserved.