Setting UITextView's and UISearchbar's keyboardAppearance through appearance() leads to non-descriptive exception

Originator:flavio
Number:rdar://27206741 Date Originated:2016-07-06
Status:Open Resolved:No
Product:iOS SDK Product Version:iOS 9.3
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
If UITextInput’s “keyboardAppearance” property is set using “appearance()” to UITextView and UISearchBar classes, an exception is thrown without description, saying “Please file a radar on UIKit if you see this assertion.”

Steps to Reproduce:
1 - Add “UITextView.appearance().keyboardAppearance = .Dark” wherever in the code
2 - Add a UITextView to a view controller
3 - Open the view controller
4 - The exception is thrown

Expected Results:
There should be no errors and the UITextView and/or UISearchBar keyboard should be the expected appearance

Actual Results:
An exception is thrown with the attached stack trace.

Regression:
I was always able to reproduce it, including in new, clean projects running in the Simulator with iOS 9.3 with Xcode 7.3.1 (7D1014)

Notes:
I’ve attached the stack trace and an example project. A workaround is possible by setting the desired keyboard appearance to each instance of UITextView or UISearchBar without using “appearance()”

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!