1
votes

I am using Facebook Sdk 4.1, https://developers.facebook.com/docs/sharing/ios#Advanced share_dialog I am using FBSDKShareDialog to share Video .It does share Video if user has installed facebook app," Idk whats wrong plz help me in sharing Video using FBSDK 4.1.

NSURL *movieUrl = [info objectForKey:UIImagePickerControllerMediaURL];
FBSDKShareDialog *shareDialog = [[FBSDKShareDialog alloc]init];
NSURL *videoURL=movieUrl;
FBSDKShareVideo *video = [[FBSDKShareVideo alloc] init];
video.videoURL = videoURL;
FBSDKShareVideoContent *content = [[FBSDKShareVideoContent alloc] init];
content.video = video;

shareDialog.shareContent = content;
shareDialog.delegate=self;
[shareDialog show];

i am getting response for console

error:Error Domain=com.facebook.sdk.share Code=2 "The operation couldn’t be completed. (com.facebook.sdk.share error 2.)" UserInfo=0x19784210 {com.facebook.sdk:FBSDKErrorArgumentValueKey=, com.facebook.sdk:FBSDKErrorArgumentNameKey=shareContent, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Share content must be FBSDKShareLinkContent or FBSDKSharePhotoContent in order to share with the share sheet.}

3
same code working on Pad 2, but not working on iPhoneDivya Smith
did you ever figure it out or find a workaround?Johanisma
For some reason it seems like shareDialog.shareContent can't be set to a variable of type FBSDKShareVideoContent. I'm not sure why this is and think it may be a bug since FB's documentation does not cover it. What a pain : POlivia Stork

3 Answers

0
votes

How can somebody share file system URL in Facebook, you must provide a valid video URL for Example :- www.xyz.org/bunny.mp4


Just make your facts right, "UIImagePickerControllerMediaURL - Specifies the filesystem URL for the video."

0
votes

Please check: 1)The videos must be less than 12MB in size. 2)People who share should have Facebook for iOS client installed, version 26.0 or higher.

You should use the below line:

NSURL *movieUrl = [info objectForKey:UIImagePickerControllerReferenceURL];

instead of

NSURL *movieUrl = [info objectForKey:UIImagePickerControllerMediaURL];
0
votes

This works with facebook app in device.

In may case i was having this error because i was testing in the simulator without facebook app.