我想使用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}