Skip to content

Fix ShareComponent crash on iPad - #75

Open
ansonhoyt wants to merge 1 commit into
joemasilotti:mainfrom
ansonhoyt:fix/share-component-ipad-popover
Open

Fix ShareComponent crash on iPad#75
ansonhoyt wants to merge 1 commit into
joemasilotti:mainfrom
ansonhoyt:fix/share-component-ipad-popover

Conversation

@ansonhoyt

@ansonhoyt ansonhoyt commented Mar 31, 2026

Copy link
Copy Markdown

Fix ShareComponent crash on iPad by setting popoverPresentationController.barButtonItem before presenting UIActivityViewController

  • Per Apple docs, iPad requires popover presentation with a source anchor
  • I tried Claude's suggested fix out locally, and it checks out.

⚠️ I know Rails, not Swift, so while Claude's suggestion lines up with Apple's docs, and it works, please give it a second look.

Fixes #74

Tested

  • Works on iPad Simulator: shows a popover
  • iPhone 17 Simulator still works: still a modal
iPhone 17 share component - modal iPad mini share component - popover

🤖 Patch generated with Claude Code

UIActivityViewController requires popoverPresentationController.barButtonItem
on iPad. Without it, presentation crashes with:
"UIPopoverPresentationController should have a non-nil sourceView or
barButtonItem set before the presentation occurs."

Fixes joemasilotti#74

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ansonhoyt
ansonhoyt marked this pull request as ready for review March 31, 2026 22:32
Copilot AI review requested due to automatic review settings March 31, 2026 22:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an iPad crash in ShareComponent by configuring the UIActivityViewController popover anchor prior to presentation, aligning with UIKit’s iPad popover requirements.

Changes:

  • Assigns activityViewController.popoverPresentationController?.barButtonItem before presenting the activity controller.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ios/components/ShareComponent.swift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ShareComponent crashes on iPad: missing popoverPresentationController config?

2 participants