April 27, 2021

Regressions on Minor iOS Updates

We've gotten used to getting new iOS version every year, and to a requisite regression cycle to make sure new iOS version has not broken anything inside the apps. In recent years though, there have been significant changes in SDK even between minor releases, and I'm not talking about feature additions, but regressions in core libraries, such as UIKit.

As one example of such regression, update from iOS 13.1 to iOS 13.2 introduced breaking change to UIAlertController. Before, it worked just fine when presented as an action sheet on iPad in compact environment on iOS 13.1 or earlier:

UIAlerController-ActionSheet-iPad.png

With iOS 13.2 and later, this is no longer the case, and running the same code results in runtime exception:

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

Oh well... 😞

Posted by Vadim at 7:13 PM | Comments (0) | TrackBack