Search code examples
iosswiftios13uialertcontrollerpresentviewcontroller

Alert with actionSheet style being shown with delayed title and message


Since iOS 13, my Alerts with actionSheet style are showing up with "delayed" title and message.

These are Apple's release notes.

I already researched a lot, but couldn't find how to make it work as it was before iOS 13.1, where the title and the message were rendered at the same time of the action buttons.

This is the method that creates the alert and present it:

    private func showRemoveConfirmationAlert() {
        let alert = UIAlertController(
            title: "Remove device?".localized(), 
            message: "Are sure you want to remove this device from your account?\nMake sure to unpair your device before removing it. This action cannot be undone.".localized(), 
            preferredStyle: .actionSheet
        )

        alert.addAction(UIAlertAction(title: "Remove".localized(), style: .destructive, handler: { _ in
            AnalyticsHelper.logRemoveDeviceConfirmedTapped()
            self.viewModel?.removeFromAccount()
        }))
        alert.addAction(UIAlertAction(title: "Cancel".localized(), style: .cancel, handler: { _ in
            AnalyticsHelper.logCancelTapped()
        }))

        if let popoverController = alert.popoverPresentationController {
            popoverController.sourceView = self.view
        }

        self.present(alert, animated: true)
    }

And this is how it looks like:

Alert being shown with delayed title and message

Any help would be appreciated! Thanks in advance.


Solution

  • First of all, thank you for the answers!

    Solution

    After a lot of investigation and testing, I found that the issue was in the Renders with edge antialiasing attribute on Info.plist.

    While developing a custom button, I added the following lines at the end of my Info.plist file to check if it makes the button renders better.

        <key>UIViewEdgeAntialiasing</key>
        <true/>
    

    It didn't improve the button rendering, but I forgot to remove it.


    Investigation

    The way I find the issue was to create a brand new project and start adding parts of the project with the issue.

    After adding all the libs and recreating some screens and behaviors with no success, I tried to compare the project settings, where this different attribute on Info.plist showed up.

    Also, I found out this related question when searching about the attribute. I probably didn't see it before because it is from 2013 and I thought that it was related to the latest iOS changes since the iOS 13 was released in September 2019, making me filter any older results.