我正在尝试新的 iOS 7 API,执行以下代码需要一分钟多的时间!
NSLog(@"start encoding");
NSString *htmlBody = @"<html><body>I am <b>bold</b> and <i>italic</i>";
NSStringEncoding encoding = NSUnicodeStringEncoding;
NSData *data = [htmlBody dataUsingEncoding:encoding];
NSDictionary *options = @{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType,
NSCharacterEncodingDocumentAttribute: @(encoding)};
NSAttributedString *body = [[NSAttributedString alloc] initWithData:data
options:options
documentAttributes:nil
error:nil];
NSLog(@"end encoding%@", body);
到底是怎么回事?