我正在尝试更新Privacy参数,以便将我的应用程序启动的实时视频发布在用户的时间轴上,并且隐私设置为“ ALL_FRIENDS”。我仔细阅读了文档,提出的代码不起作用:

NSString* livePath =  [@"/" stringByAppendingPathComponent:[token.userID stringByAppendingPathComponent:@"live_videos"]];
FBSDKProfile *profile = [FBSDKProfile currentProfile];

if(profile.userID){
    livePath = [@"/" stringByAppendingPathComponent:[profile.userID stringByAppendingPathComponent:@"live_videos"]];
}

NSMutableDictionary* param = @{
                               }.mutableCopy;
[param setObject:@"Test Title" forKey:@"title"];
[param setObject:@"Test Description" forKey:@"description"];
[param setObject:@"privacy" forKey:@"{@\"value\": \"ALL_FRIENDS\"}"];
[[[FBSDKGraphRequest alloc] initWithGraphPath:livePath
                                   parameters:param
                                  tokenString:token.tokenString
                                      version:@"v2.6"
                                   HTTPMethod:@"POST"]
 startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { //More code here }

最佳答案

我使用Facebook的图形浏览器(https://developers.facebook.com/tools/explorer/?method=POST&path=118477909176601%2Flive_videos&version=v3.2&privacy=%7B%27value%27%20%3A%20%27ALL_FRIENDS%27%7D&classic=0)弄清楚了。设置参数以更新隐私设置的代码如下。

[[[FBSDKGraphRequest alloc] initWithGraphPath:livePath
                                   parameters:@{ @"privacy": @"{'value' : 'ALL_FRIENDS'}",}
                                  tokenString:token.tokenString
                                      version:@"v2.6"
                                   HTTPMethod:@"POST"]
 startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {

关于ios - 开始直播视频时如何更新FBSDKGraphRequest中的privacy参数?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54545687/

10-11 19:48