I have successfully able to copy or add the image to pasteboard by using following code:
if (ver_float < 6.0)
{
UIPasteboard *pasteboard;
pasteboard = [UIPasteboard generalPasteboard];
NSString *filePath =pathToImage;
[pasteboard setImage:[UIImage imageWithContentsOfFile:filePath]];
}
else
{
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
NSString *filePath =pathToImage;
NSData *videoData = [NSData dataWithContentsOfFile:filePath];
[pasteboard setData:videoData forPasteboardType:[UIPasteboardTypeListImage objectAtIndex:0]];
}
NSURL *urlstr = [NSURL URLWithString:@"sms:"];
[[UIApplication sharedApplication] openURL:urlstr];
But the app which I am making is based on both images and videos so that user will be able to send image/video via imessage or messagecomposer. But as I have convert the image into data and added into pasteboard. It is working succesfully and sending through imessage. But I also need to send video via imessage. If anyone has any idea about this please provide me some suggestion or solution.
I would be very thankful for the help.
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://pathto.mp4"]];
UIPasteboard *pasteBoard = [UIPasteboard generalPasteboard];
[pasteBoard setData:data forPasteboardType:@"public.mpeg-4"];
@"public.mpeg-4"
from http://www.escape.gr/manuals/qdrop/UTI.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With