I've had this problem too, but I've solved it. Let me help you.
Add it to the main thread, and the sample code is as follows
NSMutableAttributedString *attibuteStr = [[NSMutableAttributedString alloc] initWithString:self];
dispatch_async(dispatch_get_main_queue(), ^{
NSString *htmlString = [NSString stringWithFormat:@"<html><body> %@ <font size=\"%f\"> </body></html>",self,size];
NSMutableAttributedString *attibuteStr = [[NSMutableAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUnicodeStringEncoding] options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType} documentAttributes:nil error:nil];
attibuteStr = attibuteStr;
});
return attibuteStr;
Topic:
UI Frameworks
SubTopic:
UIKit