UIDocumentPickerViewController will hang for seconds and eventually crash if NSFontAttributeName set in appearance

Originator:cescofry
Number:rdar://19266064 Date Originated:16-Dec-2014 06:11 PM
Status:Open Resolved:
Product:iOS SDK Product Version:iOS 8.1
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
When setting an NSFontAttributeName with a custom font to  UISegmentedControl  appearance (some other controls as well)  and then creating a UIDcumentPickerViewController or a UIDocumentMenuController the controller takes up to 7 seconds to show up when presented modally. 
 While using a  UIDocumentMenuController on an iPad  and the user is not logged in on an iCloud account the app will crash with 
- [_UIDimmingKnockoutBackdropView nsli_layoutEngine]%3A message sent to deallocated instance

Steps to Reproduce:
1) Add custom rtf font and set it up on info.plist
2) On AppDelegate set Font appearance for a UISegmentControl
	
    [[UISegmentedControl appearance] setTintColor%3A[UIColor redColor]]%3B
    NSDictionary *attributes %3D %40{
                                 NSFontAttributeName%3A [UIFont fontWithName%3A%40"Pacifico" size%3A16]
                                 }%3B
    
    [[UISegmentedControl appearance] setTitleTextAttributes%3Aattributes forState%3AUIControlStateNormal]%3B

3) Instantiate and present either a UIDcumentPickerViewController or a UIDocumentMenuController

Expected Results:
See the document picker in a reasonable time

Actual Results:
The UI hangs there for up to 7 seconds (the main thread is not frozen and the UI actually responds) and eventually shows the picker.  If the user is not logged in on a iCloud account the app crashes. This is on iPad while trying to present on a popoverPresentationController

Notes:
The file attached is the NewBox example from the Apple website%2C with the modification necessary to reproduce the bug (namely added the fond and the appearance on the app delegate).

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!