Ahd Radwan
Ahd Radwan

Reputation: 1100

Share video using Facebook SDK

I am trying to share a youtube video in iOS using Facebook-SDK but it always return error code 2

invalid value for videoURL

Here is my code

NSURL *videoURL =[NSURL URLWithString: @"https://youtu.be/i-QlMqZh8_g"];
FBSDKShareVideoContent *content =[[FBSDKShareVideoContent alloc]init];
content.video= [FBSDKShareVideo videoWithVideoURL:videoURL];
[FBSDKShareAPI shareWithContent:content delegate:self];

Upvotes: 2

Views: 975

Answers (1)

Victor Lins
Victor Lins

Reputation: 21

To share the youtube link:

NSURL *videoURL =[NSURL URLWithString: @"https://youtu.be/i-QlMqZh8_g"];

FBSDKShareLinkContent *shareLinkContent = [[FBSDKShareLinkContent alloc] init];
shareLinkContent.contentURL = videoURL;

[FBSDKShareAPI shareWithContent:shareLinkContent delegate:self];

Upvotes: 2

Related Questions