在Facebook上分享YouTube链接

时间:2013-08-22 14:00:21

标签: iphone ios objective-c facebook

我想与YouTube分享Facebook中的UIActivityViewController视频。

所以我创建UIActivityViewController

UIActivityViewController *activityViewController = [[UIActivityViewController alloc] 
initWithActivityItems:activityItems applicationActivities:applicationActivities];

YouTubeAppDelegate *md = (YouTubeAppDelegate*)[[UIApplication sharedApplication] delegate];
[self presentViewController:activityViewController animated:YES completion:^{}];

我将YouTube链接添加到此。

但是,当我按下Facebook中的UIActivityViewController按钮时,会将其作为Facebook中的文字发布,而不是嵌入视频播放器。 我知道如何解决它?

1 个答案:

答案 0 :(得分:3)

NSArray * activityItems = @[[NSString stringWithFormat:@"Some initial text."], [NSURL URLWithString:@"http://www.youtube.com/watch?v=yyEWkJgdftE"]];
    NSArray * applicationActivities = nil;
    NSArray * excludeActivities = @[UIActivityTypeAssignToContact, UIActivityTypeCopyToPasteboard, UIActivityTypePostToWeibo, UIActivityTypePrint, UIActivityTypeMessage];

    UIActivityViewController * activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:applicationActivities];
    activityController.excludedActivityTypes = excludeActivities;

    [self presentViewController:activityController animated:YES completion:nil];

enter image description here