我想使用UIActivityViewController
将视频分享到iPhone图库,但它没有显示"保存视频"选项。我为图像做了同样的事情,它显示了一个名为" Save Image"这会将图像保存到图库中。
我不确定出了什么问题。
NSMutableArray *sharingItems = [NSMutableArray new];
url = [NSURL URLWithString:@"http://abcd.samplevideo/7173355890_4.mp4"];
[sharingItems addObject:url];
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:sharingItems applicationActivities:nil];
[self presentViewController:activityController animated:YES completion:nil];
任何人都可以让我知道出了什么问题吗?
答案 0 :(得分:0)
下载易于分享的文件
NSURLRequest * request = [NSURLRequest requestWithURL:url];
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
NSURL *documentsURL = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] firstObject];
NSURL *tempURL = [documentsURL URLByAppendingPathComponent:[url lastPathComponent]];
[data writeToURL:tempURL atomically:YES];
[sharingItems addObject:tempURL];
dispatch_async(dispatch_get_main_queue(), ^{
[self shareSheetForMedia:sharingItems];
});
}];