Take the 2-minute tour ×

What I'm trying to do is to paste some images from my app in SMS.

UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
NSString *imagefile = [[NSBundle mainBundle] 
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:imagefile];

if (fileExists){    
    UIImage *ui = [[UIImage alloc] initWithContentsOfFile:imagefile];
    pasteboard.image = ui;
    [ui release];

In debug mode I find out that the image DOES exist, and it DOES go to pasteboard (I checked it my introducing an imageview with the image from pasteboard, and it's the necessary one).

After saving to clipboard, I call

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:"]];

it does pop-up, but when i tap to "textfield" there, no Paste button shows. Can somebody point at my mistake? Or does it make sense doing so? I mean, is it possible to send a image through Default iPhone Message App?

share|improve this question
sorry for going off the topic bro..but tell me one thing...is it possible to paste "any image" in SMS?? coz u must have same software on the decoding side.I mean on the receiver end ..right?? –  Jean-Luc Godard Apr 14 '11 at 13:11
i think this is the funny thing here: i am sure for 100% that couple of days ago, when i was just implementing this option, it really worked. after popping the default iPhone Message App, i was pasting images, it was in smth like a gray frame. I saw that it's working and i was developing other things, and now, while testing, i found out that it's not working. and i'm not sure, i will edit my Q a bit. –  Dumoko Apr 14 '11 at 13:15
I am sorry Dumoko...but i was just doing some research on this thing...but i found out that ...When you receive the message you need to decode the characters and display corresponding image for that character. For example if you receive message :-) it is ':','-' and ')' then display an smiley image... similarly different emotions for different messages. You need to maintain the list of character set and corresponding image for that set of characters...so how is that possible if the person at receiver end doesnt have app like u..i think it is not possible to decode at the other end... –  Jean-Luc Godard Apr 14 '11 at 13:20
possible duplicate of How to attach Image with message via iPhone application? –  Parth Bhatt Mar 22 '12 at 9:00

3 Answers 3

up vote 1 down vote accepted

"Paste" action will be shown only if the paste board contains the supported item for the current object(here Text Field) you tapped. It seems that you are adding only an image to the paste board. Text Field doesn't support images. So "Paste" action doesn't show up.

share|improve this answer

I have this working. I just use the setData to give it raw data and then set the data type using forPasteboardType. Right below your

    if (fileExists){

Try this

    NSData *data = [NSData dataWithContentsOfFile:imagefile];
    [pasteboard setData:data forPasteboardType:@"public.png"];            

You can look up the different PasteboardType UTI's here.

share|improve this answer
This won't work. –  Parth Bhatt Mar 22 '12 at 9:04

This code is working fine.

UIImage *image=[UIImage imageNamed:[NSString stringWithFormat:@"imageName"]];

[[UIPasteboard generalPasteboard]setImage:image];

share|improve this answer

Your Answer


