prevent crashes when ipads attempt to show an actionsheet without a source rect

This commit is contained in:
Kyle Matthew Hedden 2022-11-09 21:12:58 -05:00
parent 0bef0c5b64
commit 13fd2015e5

View File

@ -83,6 +83,11 @@
[self removeAllAlertViews];
}
if (alertStyle == UIAlertControllerStyleActionSheet && UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPhone) {
// ActionSheets are not supported on iPad interfaces without a source rect (i.e. a source element) which isn't currently supported for our generic handling.
alertStyle = UIAlertControllerStyleAlert;
}
// Create the alert. Adds the actions one by one.
MVMCoreAlertController *alertController = [MVMCoreAlertController alertControllerWithTitle:(title ?: @"") message:message preferredStyle:alertStyle];
for (NSUInteger i = 0; i < [actions count]; i++) {