I want my app to tag friend within a video-post. (Posting a video without the tags is working fine)
The account I'm using, has been added to the list of testers for my app. So I should be able to do this call without any permissions.
But the response is still: "error: (#3) Application does not have the capability to make this API call."
To get the "Taggable Friends" permission, I need upload a build of my app to fb. But I can't implement this feature without testing it by myself first.
How can I solve this chicken-and-egg problem?
My code looks like this (iOS - Objc):
NSDictionary *params = @{
@"title": @"some title",
@"description": @"some desctiption",
@"tags": _friendId
};
SLRequest *uploadRequest = [SLRequest requestForServiceType:SLServiceTypeFacebook
requestMethod:SLRequestMethodPOST
URL:videourl
parameters:params];
I have found the solution. You can't set the tag whithin the upload request (I still don't know why). But you can tag a user in the video after you uploaded the video.
When the upload succeeded, you get a videoId:
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData
options:NSJSONReadingMutableContainers
error:&error];
_currentVideoId = json[@"id"];
With this id you can make a second request:
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
}];
});
To make the second request, you need the permission for @"user_videos". If you want to tag more users, you need to make this request a few times. Maybe it's also possible with one request, but I didn't figuered out how to do it yet.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.