zeroc-ice/ice-demos

Swift iOS demo crash showing alert

Closed this issue · 2 comments

Terminating app due to uncaught exception 'NSGenericException', reason: 'Your application has presented 
a UIAlertController (<UIAlertController: 0x12f014600>) of style UIAlertControllerStyleActionSheet from 
UINavigationController (<UINavigationController: 0x12a816e00>). 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.'

This only happens with the iPad, works fine with iPhone

https://developer.apple.com/documentation/uikit/windows_and_screens/getting_the_user_s_attention_with_alerts_and_action_sheets

Seems that on iPad we need to set popoverPresentationController

Fixed in 1b94d85