Note that there are some explanatory texts on larger screens.

plurals
  1. POOther apps paste the HTML rather than the text version of our pasteboard data in iOS 5
    text
    copied!<p>We have an existing app that allows the user to copy text to the pasteboard. When possible, we put both HTML and plain text on the clipboard, since we don't know what other app the user might be pasting into and want to provide both formatted (HTML) and unformatted data.</p> <p>This functionality works great in iOS 3 and 4. But as soon as the user installs iOS 5, when they paste text from our app into any other app, the other app gets the HTML text but treats it as plain text. So if they select and copy an H1 heading, when they paste into the other app, instead of seeing "This is a Heading", they see "&lt;h1>This is a Heading&lt;/h1>".</p> <p>Note that this is with existing code that works fine in iOS 3 and 4. There's no change to our code between iOS 3, 4, and 5. </p> <p>For completeness, here's the code we use to put our text on the pasteboard, with a simple string provided just for reference:</p> <pre><code>NSString * plainText = @"A Big Heading\r\nA regular paragraph."; NSString * htmlText = @"&lt;h1&gt;A Big Heading&lt;/h1&gt;&lt;p&gt;A regular paragraph.&lt;/p&gt;"; UIPasteboard * pasteboard = [UIPasteboard generalPasteboard]; pasteboard.items = [NSArray arrayWithObject: [NSDictionary dictionaryWithObjectsAndKeys: plainText, @"public.utf8-plain-text", htmlText, @"public.html", nil]]; </code></pre> <p>Obviously, my question is "Why do iOS 5 apps get the HTML text when they request plain text, while the same app running under iOS 4 gets the plain text?"</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload