我如何测试 facebooks 好友标记

How can I test facebooks friends tagging

我想让我的应用在视频中标记朋友-post。 (发布没有标签的视频效果很好)

我正在使用的帐户已添加到我的应用程序的测试人员列表中。 所以我应该可以在没有任何权限的情况下进行此调用。

但响应仍然是: "error: (#3) Application does not have the capability to make this API call."

要获得 "Taggable Friends" 权限,我需要将我的应用程序构建上传到 fb。 但是我不能在没有先自己测试的情况下实现这个功能。

如何解决这个先有鸡还是先有蛋的问题?

我的代码如下所示(iOS - Objc):

NSDictionary *params = @{
                         @"title": @"some title",
                         @"description": @"some desctiption",
                         @"tags": _friendId
                         };
SLRequest *uploadRequest = [SLRequest requestForServiceType:SLServiceTypeFacebook
                                              requestMethod:SLRequestMethodPOST
                                                        URL:videourl
                                                 parameters:params];

我找到了解决办法。 您不能在上传请求中设置标签(我仍然不知道为什么)。 但您可以在上传视频后在视频中标记用户。

上传成功后,得到一个videoId:

NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData
                                                                 options:NSJSONReadingMutableContainers
                                                                   error:&error];

            _currentVideoId = json[@"id"];

使用此 ID,您可以发出第二个请求:

ACAccountCredential *fbCredential = [_facebookAccount credential];
NSString *accessToken = [fbCredential oauthToken];
NSString *urlStr = [NSString stringWithFormat: @"https://graph-video.facebook.com/%@/tags?access_token=%@&tag_uid=%@", _currentVideoId, accessToken, userId];

SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeFacebook
                                        requestMethod:SLRequestMethodPOST
                                                  URL:[NSURL URLWithString: urlStr]
                                           parameters: @{}];

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void) {
    [request performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {

        NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
        //Do something
    }];
});

要发出第二个请求,您需要@"user_videos" 的权限。 如果你想标记更多的用户,你需要多次发出这个请求。也许一个请求也可以,但我还没有弄清楚该怎么做。