我们可以使用Facebook SDK将文档目录视频上传到Facebook吗 [英] Could we upload the documents directory video to facebook using Facebook SDK

查看:170
本文介绍了我们可以使用Facebook SDK将文档目录视频上传到Facebook吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Facebook SDK将视频上传到Facebook时遇到问题.我正在尝试上传从SavedPhotos中选择的视频,效果很好.但是,当我尝试从我的文档目录上载视频时,它说的是以下错误. 我知道我们可以上传包含资产网址的视频.还有其他方法可以将文档目录视频上传到Facebook吗?

I have a question in uploading the video to Facebook using Facebook SDK.I am trying to upload the video which I have selected from SavedPhotos is working fine. But When I am trying to upload the video from my documents directory it is saying this below error. What I know is we can upload the video which are having the asset url. Is there any other way to upload the documents directory video to the facebook???

错误是

2015-05-26 16:30:02.369 graphtwentysixth[3025:1413799] FB: ERROR=Error Domain=com.facebook.sdk.share Code=2 "The operation couldn’t be completed. (com.facebook.sdk.share error 2.)" UserInfo=0x156b0f90 {com.facebook.sdk:FBSDKErrorArgumentValueKey=file:///private/var/mobile/Containers/Bundle/Application/48DA75B3-63BA-400A-AC92-BE6B4A2B954B/graphtwentysixth.app/demo-video-high-quality.mov, com.facebook.sdk:FBSDKErrorArgumentNameKey=videoURL, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Invalid value for videoURL: file:///private/var/mobile/Containers/Bundle/Application/48DA75B3-63BA-400A-AC92-BE6B4A2B954B/graphtwentysixth.app/demo-video-high-quality.mov}

代码

NSURL *videoURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"demo-video-high-quality" ofType:@"mov"]];

FBSDKShareVideo *video = [[FBSDKShareVideo alloc] init];
video.videoURL = videoURL;
FBSDKShareVideoContent *content1 = [[FBSDKShareVideoContent alloc] init];
content1.video = video;
[FBSDKShareAPI shareWithContent:content1 delegate:self];

感谢您的宝贵时间

推荐答案

无法从文档目录上载视频.您可以通过将视频作为资产来实现此目的,然后将资产的网址提供给Facebook,并在完成处理程序调用时从图库中删除该视频资产.这是一个技巧,但不是一个好的解决方案,因为当您将视频变成厨房资产时,它将在savePhotos中可见.

The video cannot be uploaded from document directory. You can achieve this by making video an asset and than give the url of asset to Facebook and on completion handler call delete that video asset from gallery. This is a trick but not a good solution as when you make video an asset of galley it will visible in savedPhotos.

这篇关于我们可以使用Facebook SDK将文档目录视频上传到Facebook吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆