Search code examples
htmliosios6sharing

UIActivityViewController with HTML


When I pass a string containing HTML content as an array element to the UIActivityViewController initWithActivityItems method it doesn't present it as HTML in the selected 'share' controller, but instead presents the HTML source (i.e. the markup rather than interpreting it).

And while I can understand why it would do this for share targets that don't support html content, it won't interpret it for things like email either, which do (previously this would be done by setting the isHTML property to YES on the MFMailComposeController).

Should I waste my time creating a UIActivityItemProvider that returns custom content based on the 'activity type' or is there really no way to get the mail controller presented by the UIActivityViewController to interpret the content as HTML?


Solution

  • What activities are you looking to support? Activity types are dependent on the service, and they're pretty clearly defined. There's no way for services to know that a string is a plain text or marked-up text, for example--you might want to paste HTML code on purpose.

    You can always do things the old-fashioned way and copy plain text and HTML to the pasteboard, or call the mail composer directly, or whatever you're trying to accomplish.