我想使用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];
,但没有得到发布给在委托错误说 错误域= “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}