Update: Added bug 12408800 on Apple's site.
I am copying some one or multiple UIImage to the UIPasteboard, and it's been working like gangbusters.. until my phone upgraded to iOS 6.
- Xcode 4.5 with iOS 5.1 - OK
- Xcode 4.4 with iOS 6.0 - Also OK (according to this post)
- Xcode 4.5 with iOS 6.0 - FAIL
(also tested distributing via TestFlight, for what it's worth - still fails)
Here's my code (super basic, etc):
// add image to clipboard
UIImage *image = [[UIImage imageNamed:@"testimage"];
[[UIPasteboard generalPasteboard] setPersistent:YES];
[[UIPasteboard generalPasteboard] setImage:image];
And here is what happens when I try to paste in an MMS/iMessage window (sorry for huge screenshot; retina display..):
..and an example of a failure on the Messages sample app in the iOS6 simulator (see the two question marks..?):
Like I said, the above code has been working for ages, so I'm sure this is something new.
Any thoughts? On the linked post, the author suggests re-compiling on an old version of Xcode - but wouldn't that cause other iOS6 libraries to stop working?
I sent an email about this issue to Apple Developer Technical Support and I got this reply:
So it is a bug for sure...
For only one image, you should use:
For JPEG:
or For PNG:
and avoid indexing directly in UIPasteboardTypeListImage.
This works for me on Xcode 4.5 for my iOS 6 devices.