zeroc-ice / ice-demos

Sample programs for Ice
https://zeroc.com
GNU General Public License v2.0
325 stars 217 forks source link

Swift iOS demo crash showing alert #145

Closed pepone closed 2 years ago

pepone commented 2 years ago
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.'
pepone commented 2 years ago

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

pepone commented 2 years ago

Fixed in https://github.com/zeroc-ice/ice-demos/commit/1b94d857d0a664fa01fa17e82aa85c4b98393100