如何在Twitter上分享UIActivityViewController的视频

时间:2016-08-04 05:23:10

标签: ios video twitter uiactivityviewcontroller

我想在社交网络上分享文字,图片,链接和视频(来自这些)。我成功地共享了文字,链接和图像。我有视频和图像的网址。我搜索并发现我们可以分享我们本地的视频。首先,我从该网址下载视频并在uiactivityitem中附加视频。我的问题我无法在Twitter上分享视频,它没有显示分享的推特选项,但在Facebook工作正常。

我的代码是

NSString *sharestrurl=@"http://exmaple.com/abc.mp4";
NSFileManager *fileManager = [NSFileManager defaultManager];

NSString *filextension=@"mp4";
NSString *filetitle=@"abc";

NSString *destinationFilename =[NSString stringWithFormat:@"%@.%@",filetitle,filextension];

NSURL *destinationURL = [self.docDirectoryURL URLByAppendingPathComponent:destinationFilename];

NSURL *ShareURL=destinationURL;

if ([fileManager fileExistsAtPath:[destinationURL path]]) {
            NSLog(@"file exist");

            sharedObjects = [NSMutableArray arrayWithObjects:@"Hey, check out this business! It is awesome!",ShareURL,nil];

 }else{

            SHOWALERT(@"Please download video before share");

}

UIActivityViewController *activityViewController = [[UIActivityViewController alloc]  initWithActivityItems:sharedObjects applicationActivities:nil];


    activityViewController.excludedActivityTypes = @[
                                                     UIActivityTypeAddToReadingList,
                                                     UIActivityTypeAssignToContact,
                                                     UIActivityTypePrint,
                                                     UIActivityTypeSaveToCameraRoll,
                                                     UIActivityTypeCopyToPasteboard,
                                                     UIActivityTypeAirDrop
                                                     ];


    dispatch_async(dispatch_get_main_queue(), ^{
        [self presentViewController:activityViewController animated:YES completion:nil];
    });

0 个答案:

没有答案