title: How do i convert NSAttributedString into HTML string?
body: <p>As the title tells,now i can simple convert HTML into <code>NSAttributedString</code> with <code>initWithHTML:documentAttributes:</code> , but what i want to do here is reverse.
  Is there any 3rd party library to achieve this?</p>
  
  <pre><code>   @implementation NSAttributedString(HTML)
  -(NSString *)htmlForAttributedString{
      NSArray * exclude = [NSArray arrayWithObjects:@"doctype",
                           @"html",
                           @"head",
                           @"body",
                           @"xml",
                           nil
                           ];
      NSDictionary * htmlAtt = [NSDictionary
                                dictionaryWithObjectsAndKeys:NSHTMLTextDocumentType,
                                NSDocumentTypeDocumentAttribute,
                                exclude,
                                NSExcludedElementsDocumentAttribute,
                                nil
                                ];
      NSError * error;
      NSData * htmlData = [self dataFromRange:NSMakeRange(0, [self length])
                                 documentAttributes:htmlAtt error:&amp;error
                           ];
          //NSAttributedString * htmlString = [[NSAttributedString alloc]initWithHTML:htmlData documentAttributes:&amp;htmlAtt];
      NSString * htmlString = [[NSString alloc] initWithData:htmlData encoding:NSUTF8StringEncoding];
      return htmlString;
  }
  @end
  </code></pre>