Issues with UIFocusItemContainer since tvOS 16

I implemented a game for Apple TV where I have multiple SKSpriteNodes in a SKScene. Before tvOS 16 everything worked correctly, I could move around with the remote and focus all items in the correct way. Now, with tvOS 16, the app crashes with the following error:

Focus item RandomSKSpriteNode has a parent focus environment of MySKScene but this environment does not provide a container for focus items.

So then I tried to just set the SKScene's view, the parent environments focus item container, an empty view and more as the SKScene's focusItemContainer - this fixed the crash, but the focus behaves quite randomly. Some of the nodes cannot be focused then anymore, and the focus just jumps to random nodes, and not the one in which direction I swiped to.

override var focusItemContainer: UIFocusItemContainer? {
    return view // parentFocusEnvironment?.focusItemContainer // UIView()
}

Does anyone have an idea what I have to set here as the focusItemContainer? It's so strange because everything worked before and I also cannot find anything about any breaking changes in the release notes. If you have any hints for that issue please let me know!

Post not yet marked as solved Up vote post of Silagon Down vote post of Silagon
972 views
  • Im having a similar error where everything else was working alright till now. But now I'm getting this error *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Focus item <UITabBarButton: 0x12c086990> does not provide a parentFocusEnvironment. This happens when I open the app again after minimising it once.

Add a Comment