我想用sdk在脸书墙上分享图片和视频。
我使用下面的代码来分享图片
FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
photo.image = [UIImage imageNamed:@"Classic-Guitar.jpg"];
photo.userGenerated = YES;
FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];content.photos = @photo;
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];但是它没有被发布,在委托中给出了一个错误,说error Domain=com.facebook.sdk.share Code=2 "The operation Domain=com.facebook.sdk.share Code=2. (com.facebook.sdk.share Error 2.)“videoURL的{com.facebook.sdk:FBSDKErrorArgumentValueKey=https://www.youtube.com/watch?v=rSAiSTkVMfs,com.facebook.sdk:FBSDKErrorArgumentNameKey=videoURL,com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Invalid值: UserInfo=0x16d95990 }
发布于 2015-10-19 18:45:22
videoURL属性必须是资产URL (从UIImagePickerController获取),而不是本地文件URL/web (请参阅https://developers.facebook.com/docs/sharing/ios#videos)
如果你想分享YouTube视频(或网站上提供的任何视频),请改用FBSDKShareLinkContent (参见https://developers.facebook.com/docs/sharing/ios#links)
https://stackoverflow.com/questions/33122932
复制相似问题