如何在IOS上与Facebook上的视频共享HashTag文本?

时间:2017-01-04 13:37:50

标签: objective-c facebook-graph-api ios10 facebook-sdk-4.x

我在我的IOS应用程序上分享Facebook上的视频(没有SLComposer)。它会成功发送,但我想用它添加HashTag文本。我正在尝试但它不会与视频共享(只有视频共享)。

FBSDKShareVideo *ShareVideo = [FBSDKShareVideo videoWithVideoURL:appDelegateObj.finalVideoUrl];
ShareVideo.videoURL = appDelegateObj.finalVideoUrl;
FBSDKShareVideoContent *ShareContnt = [[FBSDKShareVideoContent alloc] init];
ShareContnt.video = ShareVideo;
ShareContnt.hashtag =  [FBSDKHashtag hashtagWithString:[NSString stringWithFormat:@"%@",@"We are #sharing this #video for the #testing of #video and the #HashTag Text"]];
[FBSDKShareAPI shareWithContent:ShareContnt delegate:self];

请帮我解决这个问题?

1 个答案:

答案 0 :(得分:0)

100%工作 我得到了这些ANS ......

//使用这些代码我们只分享无法发送文字/标题或视频名称......

- (无效)facbookSharng {

NSLog(@"Permission for sharing..%@",[FBSDKAccessToken currentAccessToken].permissions);
if ([[FBSDKAccessToken currentAccessToken] hasGranted:@"contact_email"])
{
    FBSDKShareVideo *ShareVideo = [FBSDKShareVideo videoWithVideoURL:appDelegateObj.finalVideoUrl];
    ShareVideo.videoURL = appDelegateObj.finalVideoUrl;
    FBSDKShareVideoContent *ShareContnt = [[FBSDKShareVideoContent alloc] init];
    ShareContnt.video = ShareVideo;
    [FBSDKShareAPI shareWithContent:ShareContnt delegate:self] 

      // write the deleate methdo for post ID..
}

}

//但是对于这些Facebook提供了另一种方式,

NSLog(@“分享权限..%@”,[FBSDKAccessToken currentAccessToken] .permissions);     if([[[FBSDKAccessToken currentAccessToken] hasGranted:@“contact_email”])     {

NSData *videoData = [NSData dataWithContentsOfURL:appDelegateObj.finalVideoUrl];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:3L];

[params setObject:videoData forKey:@"video_filename.MOV"];
[params setObject:@"Title for this post." forKey:@"title"];
[params setObject:@"#Description for this post." forKey:@"description"];

[[[FBSDKGraphRequest alloc] initWithGraphPath:@"/me/videos" parameters:params HTTPMethod:@"POST"]
 startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
     if (!error) {
         //video posted
         NSLog(@"Facebook sharing completed %@:",result);
         strFbSocialPostId = [result valueForKey:@"id"];//post ID
     }
 }];

}