使用 ios 应用中的 facebook sdk4.0 在 facebook 上分享视频

Sharing Video on facebook using facebook sdk4.0 from ios app

在我的 iOS 移动应用程序中,我需要 share/upload Facebook 帐户上的视频(来自照片库或使用相机拍摄)。我正在使用 iOS 8.0 和 FacebookSDK 4.0。我尝试了很多代码,但其中任何一个都不起作用。我已经成功完成了以下步骤。 1) 使用 'publish_action' 权限登录 facebook 2) 用户确实在 FBSDKAccessToken
中拥有有效的访问令牌 正如官方 FB 文档中所述,我已经这样做了

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
NSURL * selectedVideoUrl = [info objectForKey:UIImagePickerControllerMediaURL];
[self dismissViewControllerAnimated:picker completion:nil];

FBSDKShareVideo *video = [[FBSDKShareVideo alloc] init];
video.videoURL = selectedVideoUrl;
FBSDKShareVideoContent *content = [[FBSDKShareVideoContent alloc] init];
content.video = video; 
//here now i have tried both the techniques mentioned below  
}

现在我尝试使用 FBSDKShareDialog 发布此内容,但它不起作用并抛出错误,我也尝试使用 FBSDKShareAPI 像这样

FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init];
dialog.delegate=self;
dialog.fromViewController = self;
dialog.shareContent=content;
[dialog show];

像这样

FBSDKShareAPI *shareRequest= [FBSDKShareAPI shareWithContent:content delegate:self];
if ([shareRequest canShare]) {
    BOOL isSuccess=[shareRequest share];
    if (isSuccess) {
        NSLog(@"shared");
    }
}

我怎样才能让这个上传工作?

使用UIImagePickerControllerReferenceURL获取资产库URL而不是UIImagePickerControllerMediaURL