iOS 9b5: [application keyWindow] becomes nil after window dealloc

Originator:me
Number:rdar://22364739 Date Originated:20/8/2015
Status:Open Resolved:
Product:iOS Product Version:iOS 9 beta 5
Classification:UI/Usability Reproducible:Always
 
Summary:
Under iOS 9, If an application creates a second UIWindow, makes it key and visible, and then later closes the second window by nulling its last reference to it, the application’s first window does not become key; and [application keyWindow] returns nil.

This is a regression from iOS 8 and earlier, where the application’s first window would become key after the second window was closed.

Workaround: If the second window is hidden immediately prior to being closed, the application’s first window does become key as expected.

This issue has been observed (via side effects) on iOS 9 betas 2, 3, and 5, but we did not pin down this cause until beta 5.

Steps to Reproduce:
1. In an iOS application, after launching, observe that [[UIApplication sharedApplication] keyWindow] is the application's first window.
2. Alloc and init a second window. Keep a strong reference to this second window.
3. Make the second window key and visible.
4. Observe that [[UIApplication sharedApplication] keyWindow] returns the second window.
5. Release the strong reference to the second window.
6. Observe that the window disappears from the screen as it is closed.
7. Observe [[UIApplication sharedApplication] keyWindow] now.

Expected Results:
The key window should now be the first window again.

Actual Results:
The key window is nil.

Version:
iOS 9 beta 5.

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!