Note that there are some explanatory texts on larger screens.

plurals
  1. POattach a local video using UIActivityViewController
    text
    copied!<p>I'm writing an iOS app that has locally saved videos (.mov). I'm trying to attach the video via UIActivityViewController. It works great for email. The video is successfully attached and sent. It also works when saving to camera roll.<br> It doesn't work when attaching to Messages. Only the text is shown. Also Twitter and Facebook do not even show up. When I remove the video attachment, Twitter and Facebook finally begin to show. I don't really care too much about Messages but can anyone tell me why Facebook and Twitter are not showing up?</p> <p>Heres my code:</p> <pre><code>- (IBAction) shareVideo { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *URL = [documentsDirectory stringByAppendingPathComponent:demoName]; NSString* someText = demoName; NSURL *urlToShare = [NSURL fileURLWithPath:URL isDirectory:NO]; NSArray* dataToShare = @[someText, urlToShare]; UIActivityViewController* activityViewController = [[UIActivityViewController alloc] initWithActivityItems:dataToShare applicationActivities:nil]; activityViewController.excludedActivityTypes = @[UIActivityTypePrint,UIActivityTypeCopyToPasteboard,UIActivityTypeAssignToContact]; activityViewController.completionHandler = ^(NSString *activityType, BOOL completed) { //if (completed) { [self dismissViewControllerAnimated:YES completion:nil]; //} }; [self presentViewController:activityViewController animated:YES completion:nil]; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload