我已经通过使用以下代码成功地将图像复制或添加到粘贴板:
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];但我正在制作的应用程序是基于图像和视频,以便用户将能够通过imessage或messagecomposer发送图像/视频。但我已经将图像转换为数据并添加到粘贴板中。它正在成功地工作,并通过imessage发送。但我也需要通过imessage发送视频。如果任何人对此有任何想法,请给我一些建议或解决方案。
我将非常感谢你的帮助。
发布于 2012-12-21 20:15:13
我也面临着同样的问题,从短信发送音频文件。但是目前的SDK还不能通过短信发送视频和音频。您可以通过将视频上传到服务器,然后发送上传的URL来完成此操作。
How to programmatically send voicemail message on the iPhone?
发布于 2014-10-29 14:08:46
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://pathto.mp4"]];
UIPasteboard *pasteBoard = [UIPasteboard generalPasteboard];
[pasteBoard setData:data forPasteboardType:@"public.mpeg-4"];来自http://www.escape.gr/manuals/qdrop/UTI.html的@"public.mpeg-4"
https://stackoverflow.com/questions/13989625
复制相似问题