App is crashing when trying to present alert over keyboard

Hi,

Using UITextInput, I'm gathering text from the keyboard to display in a custom text view. The user is only allowed to enter 10 characters in the lite version of my app and if that number is exceeded, the "shouldChangeTextInRange" method posts an alert asking the user to upgrade rather than insert the text in the text view.

In iOS16, I'm noticing when I test with swipe typing and the character limit is exceeded, when I try to post the alert over the keyboard the app locks up and I get the following in the console:

-[UIKeyboardTaskQueue lockWhenReadyForMainThread] timeout waiting for task on queue.

Keyboard queue task timeout detected

You can see what I mean in the following video:

https://vimeo.com/752856336

The first part of the video is on the iOS15 simulator and it works, the alert pops up successfully. The second half is the iOS16 simulator where it freezes when I try to post the alert.

I'm guessing that the suggestions toolbar that appears when you swipe type is what's causing this.

Going to report this as a bug to Apple but was wondering if anyone might know a workaround for this? Thanks!