Skip to content

Conversation

@trilogy-taro
Copy link

@trilogy-taro trilogy-taro bot commented Sep 13, 2025

Summary

  • Fixed NSGenericException crash when sharing documents on iPad devices
  • Added proper popover presentation controller configuration for UIActivityViewController
  • Maintains backward compatibility with iPhone (full-screen presentation)

Problem

The Brand Messenger SDK was crashing on iPad when users attempted to share documents from the chat viewer. The crash was caused by UIPopoverPresentationController missing required anchor configuration on iPad devices.

Solution

Added popover presentation controller configuration in two locations:

  1. onAction method (line 74): Added barButtonItem anchor for toolbar share button
  2. openOptionsMenuFor method (line 131): Added sourceView/sourceRect for alert action share

Test Plan

  • Verified fix addresses the crash in both share scenarios
  • Ensured backward compatibility with iPhone devices
  • Test on physical iPad device with Brand Messenger SDK 1.16.4
  • Test sharing both documents and images
  • Verify popover appears correctly on iPad
  • Verify full-screen presentation on iPhone

References

🤖 Generated with Claude Code

This commit fixes a NSGenericException crash that occurs when sharing
documents from the chat viewer on iPad devices. The crash was caused by
missing popover presentation controller configuration required for iPad.

Changes:
- Added popover anchor configuration for bar button item in onAction method
- Added popover source view configuration for alert action share in openOptionsMenuFor method
- Set appropriate source rect and arrow directions for centered presentation

The fix ensures UIActivityViewController properly displays as a popover on
iPad while maintaining full-screen presentation on iPhone devices.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

1 participant