I am using the native iOS share sheet and it works for everything: Mail, Photos, Facebook. Everything except YouTube. I tried .mov
and .mp4
extensions and files with different size.
Update.
The share sheet with video also doesn't display Twitter option. This is also true for the Photos or Camera. However, Photos' share sheet displays YouTube icon, this tells me that I'm doing something wrong.
This status bar was edited in the Altershot.
NSData *urlData = [NSData dataWithContentsOfURL:urlToDownload];
if (urlData) {
// File downloaded
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [NSString stringWithFormat:@"%@/%@", documentsDirectory,@"file.mov"];
[urlData writeToFile:filePath atomically:YES];
// File saved
NSURL *videoLink = [NSURL fileURLWithPath:filePath];
NSArray *activityItems = @[videoLink];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
[activityViewController setValue:@"Video" forKey:@"subject"];
if (IS_IPAD) {
self.popover = [[UIPopoverController alloc]
initWithContentViewController:activityViewController];
[self.popover presentPopoverFromRect:self.shareButton.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
} else {
[self presentViewController:activityViewController animated:YES completion:nil];
}
}