0

I'v thought that dealing with UIPasteboard is easy but it turned out to be a time-consuming issue...

I want to store an UIImage in UIPasteboard and then paste this image in iMessage, WhatsApp, Gmail... and others.

That's my method where I use UIPasteboard

- (void) postClipboard
{
    if ([[modelView currentView] isImage])
    {
        UIImage *image = [self readyImageLandscape:orientationLandscape];
        [[UIPasteboard generalPasteboard] setImage:image];
    }
}

It works on iPhone 3GS 5.1. I've tested it on Gmail and WhatsApp

Then I modified the method to

- (void) postClipboard
{
    if ([[modelView currentView] isImage])
    {
        UIImage *image = [self readyImageLandscape:orientationLandscape];
        [[UIPasteboard generalPasteboard] setImage:image];
        [[UIPasteboard generalPasteboard] setPersistent:YES];
    }
}

Still works on iPhone 3GS 5.1.

But my employer says that it doesn't work on iPhone 4S 6.0 neither in WhatsApp nor in any other application.

Am I doing all wrong or there should be another approach to make it work on iPhone 4S 6.0?

4

1 回答 1

2

See this answer: https://stackoverflow.com/a/12613632/830946

Looks like that code will work with a single image, but not with multiple.

于 2012-11-08T08:07:44.940 回答