我正在编写一个具有本地保存视频 (.mov) 的 iOS 应用程序。我正在尝试通过 UIActivityViewController 附加视频。它非常适合电子邮件。视频已成功附加并发送。保存到相机胶卷时也可以使用。
附加到消息时它不起作用。仅显示文本。Twitter 和 Facebook 也没有出现。当我删除视频附件时,Twitter 和 Facebook 终于开始显示了。我不太关心消息,但谁能告诉我为什么 Facebook 和 Twitter 没有出现?
这是我的代码:
- (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];
}