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
In my testing if the string begins "
" and ends "" then it is treated as HTML.If you want a good result with the non-HTML-aware sharing services you need to instead use an object that implements the UIActivityItemSource protocol and returns the HTML string when from -activityViewControllerPlaceholderItem:
and from -activityViewController:itemForActivityType:
if the activity is UIActivityTypeMail
and nil
otherwise.
A second UIActivityItemSource that returns a suitable non-HTML string from -activityViewControllerPlaceholderItem:
and from -activityViewController:itemForActivityType:
if the activity is not UIActivityTypeMail
(and nil
if it is) is the rest of the puzzle.
I recommend against having one object do both jobs, as the UIActivity
engine is entitled to make different decisions based on whether the placeholder item appears to be HTML or not.