tvOS 14 and earlier crash on launch in [UnityView(Keyboard) createKeyboard]

Hello. I received a bug from my testers that my tvOS build was crashing immediately on launch. Looking at the crash log from Test Flight in Xcode, it looks like the problem is inside the unity startup procedure.

The game is made with Unity 2021.3.7 with Xcode 13.4.1. I have the deployment target set to 13.0

The tester was trying to run the game on an Apple TV 4K running a tvOS 14.2.

As you can see from the stack trace, it looks like somehow the code is making it past the check for “iOS 15.0”, and trying to access a member variable of UIKeyCommand that didn’t exist before OS version 15.

The tester updated their Apple TV to tvOS 15 and the build runs properly. Perhaps this is a bug related to the minor differences between iOS and tvOS?

Not sure how (if possible) to fix this on my end without simply requiring tvOS 15 or newer, which would severely limit the target audience

Call stack:
8426481--1115412--Screen Shot 2022-09-08 at 2.38.29 PM.png

Line where the exception occurs:

yes, this is our fuckup. You can change it like this

-        if (@available(iOS 15.0, *))
+        if (@available(iOS 15.0, tvOS 15.0, *))
             command.wantsPriorityOverSystemBehavior = YES;

We will release the fix (hopefully) soon

Thanks for the reply. I’ll make the change locally on my builds until a fix is available.