NSAttributedString from HTML data: slow and main thread only

Originator:steipete
Number:rdar://20973981 Date Originated:15-May-2015 04:09 PM
Status:Open Resolved:
Product:iOS SDK Product Version:iOS 8.3
Classification:Serious Bug Reproducible:Always
 
Summary:
-[NSAttributedString initWithData:options:documentAttributes:error] is slow and can only be used on the main thread. This should work on any thread.

Steps to Reproduce:
See attached example project that shows the slowness and the possible crash

Expected Results:
1. Fast conversion of a HTML string to a NSAttributedString
2. Usable from every thread

Actual Results:
1. VERY slow
2. Can crash in a background thread (because WebKit)

Notes:
To be fair, I didn’t managed to build a sample that crashes, these crashers are random and are easier to happen in a larger application where more stuff is going on with different html pages being parsed at the same time.

Comments

Example: http://cl.ly/3A1n3J3B442V


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!