将带有图像附件的HTML文本转换为NSString

时间:2016-10-27 04:56:07

标签: ios objective-c

我正在接受API:

 "<p>The message will be &ldquo;Check out This app. I really think you&rsquo;ll relate to this.<img alt=\"smiley\" src=\"serverURL/regular_smile.png\" style=\"height:23px; width:23px\" title=\"smiley\" /></p>
\n"

现在我想将其转换为NSString。我试过跟随,但它没有给我回复图像。

NSMutableAttributedString *txtToShare = [[NSMutableAttributedString alloc] initWithData:    [[dict valueForKey:@"description"] dataUsingEncoding:NSUnicodeStringEncoding]
                                                                                                options:@{     NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType
                                                                                                               } documentAttributes:nil error:nil];

注意:这里[dict valueForKey:@“description”]包含我上面写的Html文本

输出:消息将是“查看此应用程序。我真的认为你会与此有关。 regular_smile.png

如何获得图像?

0 个答案:

没有答案
相关问题