Instantiating the window directly on the property declaration on an AppDelegate prevents focus events to be forwarded to tvOS app

Originator:oscar
Number:rdar://27815981 Date Originated:11/08/2016
Status:Duplicate of 22960838 Resolved:Closed
Product:tvOS/Xcode Product Version:8 b5
Classification:Serious Bug Reproducible:Always
 
Summary:
In a project that does not use Storyboards, if the window property on the application's AppDelegate is instantiated directly on the property declaration, the focus events are not forwarded to the applications responders.

Steps to Reproduce:
1. Download the attached Xcode project and open AppDelegate.swift
2. Run the tvos_bug target on the Apple TV Simulator for iOS 10
3. Try to interact with the table view, and you can't.
4. On AppDelegate.swift, go to line 116 and uncomment it. Now, go to line 112 and leave the property declaration as follows:

var window: UIWindow?

Leave everything else as-is.

5. Run the project again. Now you can move the focus around.

You can check that this is not only happening with UITableView by changing the rootViewController for the window to be an instance of ViewController and trying to move focus between the two UIButtons on screen.

Expected Results:
As long as the window is instantiated correctly and made key and visible, all focus events should be able to go through the responder chain.

Actual Results:
If the window property is instantiated from the property declaration itself, focus events are not being forwarded.

Version:
This is reproducible on Xcode 8 b4 and b5 as far as I can tell.

Download example project: http://oscarswanros-personalcloud.s3.amazonaws.com/tvos_bug.zip

Comments


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!