Can't initialize UIFocusUpdateContext - invalid parameter not satisfying: focusSystem (NSInternalInconsistencyException)

Originator:marcel.mendes
Number:rdar://FB11952501 Date Originated:17/01/2023
Status:Open Resolved:No
Product:UIKit Product Version:tvOS 14 or greater
Classification: Reproducible:Yes
 
Please provide a descriptive title for your feedback:
Can't initialize UIFocusUpdateContext - invalid parameter not satisfying: focusSystem (NSInternalInconsistencyException)

Which area are you seeing an issue with?
UIKit

What type of feedback are you reporting?
Incorrect/Unexpected Behavior

Please describe the issue and what steps we can take to reproduce it:

Trying to initialize UIFocusUpdateContext object in Swift using UIFocusUpdateContext() but Xcode 14.2 displays the following error: Invalid parameter not satisfying: focusSystem (NSInternalInconsistencyException).

This error only occurs when I select tvOS 14 or greater as the target. It works fine when I select tvOS 13 or earlier.

Need to init UIFocusUpdateContext to be able to extend this class as a dummy class to use it to simulate focus changes in Unit Tests.

Development environment:
Xcode 12.4
Device targets (simulator):
tvOS 13.4 (works fine)
tvOS 14.5 (doesn’t work - get error)
tvOS 15.4 (doesn’t work - get error)
tvOS 16.0 (doesn’t work - get error)

Comments

I’ve noticed that the bug doesn’t happen when I run ALL target unit tests. It only happens when I run class tests or a specific test.

By marcel.mendes at Jan. 19, 2023, 12:34 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!