hotwired / turbo-ios

iOS framework for making Turbo native apps
MIT License
874 stars 88 forks source link

Alert for iPad instead of an ActionSheet #193

Closed solilin closed 6 months ago

solilin commented 6 months ago

There's an issue in the MenuComponent Demo on iPads. When clicking on menu icons, the app crashes with the following error:

Terminating app due to uncaught exception 'NSGenericException', reason: 'Your application has presented a UIAlertController (<UIAlertController: 0x106808800>) of style UIAlertControllerStyleActionSheet from UINavigationController (<UINavigationController: 0x10780aa00>). The modalPresentationStyle of a UIAlertController with this style is UIModalPresentationPopover. 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.

We need to specify the position. I'm not sure how to implement it, so I simply changed actionSheet to alert for iPads.

solilin commented 6 months ago

I have find another solution https://github.com/hotwired/turbo-ios/pull/194