【问题标题】:Video Sharing on facebook脸书上的视频分享
【发布时间】:2015-10-14 10:29:24
【问题描述】:

我想使用 sdk 在 Facebook 墙上分享图片和视频。

我使用以下代码分享图片

FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
photo.image = [UIImage imageNamed:@"Classic-Guitar.jpg"];
photo.userGenerated = YES;
FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];

content.photos = @[照片];

FBSDKShareDialog *shareCodeDialog;
shareCodeDialog = [FBSDKShareDialog new];
[shareCodeDialog setDelegate:self];
[shareCodeDialog setShareContent:content];
[shareCodeDialog setFromViewController:self];
[shareCodeDialog show];

使用此代码我可以在墙上发布图像,但在发送视频时我使用以下代码

NSURL *videoURL = [[NSURL URLWithString:@"https://www.youtube.com/watch?v=rSAiSTkVMfs"] absoluteURL];
FBSDKShareVideo *video = [[FBSDKShareVideo alloc] init];
video.videoURL = videoURL;
FBSDKShareVideoContent *content = [[FBSDKShareVideoContent alloc] init];
content.video = video;


FBSDKShareDialog *shareCodeDialog;
shareCodeDialog = [FBSDKShareDialog new];
[shareCodeDialog setDelegate:self];
[shareCodeDialog setShareContent:content];
[shareCodeDialog setFromViewController:self];
[shareCodeDialog show];

但它没有被张贴给和错误的代表说 错误 Domain=com.facebook.sdk.share Code=2 “操作无法完成。(com.facebook.sdk.share 错误 2。)” UserInfo=0x16d95990 {com.facebook.sdk:FBSDKErrorArgumentValueKey=https://www.youtube.com/watch?v=rSAiSTkVMfs , com.facebook.sdk:FBSDKErrorArgumentNameKey=videoURL, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=videoURL 的值无效:https://www.youtube.com/watch?v=rSAiSTkVMfs}

【问题讨论】:

    标签: ios facebook


    【解决方案1】:

    videoURL 属性必须是资产 URL(您从 UIImagePickerController 获得的)而不是本地文件 URL/Web URL(请参阅https://developers.facebook.com/docs/sharing/ios#videos

    如果您想分享 YouTube 视频(或网站上的任何视频),请改用 FBSDKShareLinkContent(请参阅 https://developers.facebook.com/docs/sharing/ios#links

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-03
      • 2011-12-01
      • 1970-01-01
      • 2012-09-28
      • 1970-01-01
      相关资源
      最近更新 更多