Error sharing video on Facebook iOS Target C

I'm trying to share a video on Facebook, I'm using the new version of fbsdk 4.1.0 I also followed the instructions in developer.facebook.com

  • Video size must be less than 12 MB.
  • People who share must have Facebook installed for the iOS client, version 26.0 or higher.

I used the following code to share videos on facebook

FBSDKShareDialog *shareDialog = [[FBSDKShareDialog alloc]init];

NSURL *videoURL=[info objectForKey:UIImagePickerControllerMediaURL];

FBSDKShareVideo *video = [[FBSDKShareVideo alloc] init];
video.videoURL = videoURL;
FBSDKShareVideoContent *content = [[FBSDKShareVideoContent alloc] init];
content.video = video;

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

but the problem is im get is,

Error Domain=com.facebook.sdk.share Code=2 "The operation couldn’t be completed. (com.facebook.sdk.share error 2.)" UserInfo=0x174479f40 {com.facebook.sdk:FBSDKErrorArgumentValueKey=<FBSDKShareVideoContent: 0x174475040>, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Only asset file URLs are allowed for the native dialog., com.facebook.sdk:FBSDKErrorArgumentNameKey=videoURL}

thank

+4
source share
1 answer

Use UIImagePickerControllerReferenceURL instead of UIImagePickerControllerMediaURL.

0
source

All Articles