Add current location posting video in facebook

2019-09-08 04:14发布

问题:

I need send the location in a post in facebook using the place key. As shown here

At first I thought I had to send an object with the latitude and longitude into a location called key.

Then I realized that you have to send in one place key place_id

Managed to get the closest place_id with this

NSMutableDictionary *params2 = [NSMutableDictionary dictionaryWithCapacity:4L];

    [params2 setObject:@"37.416382,-122.152659" forKey:@"center"]; //Hard code coordinates for test
    [params2 setObject:@"place" forKey:@"type"];
    [params2 setObject:@"1000" forKey:@"distance"];

    [[[FBSDKGraphRequest alloc] initWithGraphPath:@"/search" parameters:params2 HTTPMethod:@"GET"] startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
        NSLog(@"RESPONSE!!! /search");
        NSLog(@"result %@",result);
        NSLog(@"error %@",error);
    }];

So, when i tried to send a post using /me/videos with the location, a error appear.

(#3) Application does not have the capability to make this API call.

Here my code.

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:4L];

    [params setObject:videoData forKey:[NSString stringWithFormat:@"%@.MOV",title]];
    [params setObject:title forKey:@"title"];
    [params setObject:desc forKey:@"description"];

    [params setObject:@"110503255682430" forKey:@"place"];// hard code for test

    NSString *privacyString = @"EVERYONE";
    if (privacy.length > 0)
        privacyString = privacy;

    NSDictionary *privacyDict = [[NSDictionary alloc] initWithObjectsAndKeys: privacyString, @"value", nil];
    [params setObject:[Utils objectToJsonString:privacyDict] forKey:@"privacy"];

    [[[FBSDKGraphRequest alloc] initWithGraphPath:@"/me/videos" parameters:params HTTPMethod:@"POST"] startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {

        NSLog(@"RESPONSE!!! /me/videos");
        NSLog(@"result %@",result);
        NSLog(@"error %@",error);

        if (!error) {
             //video posted
             [[[UIAlertView alloc] initWithTitle:@"Success" message:@"Your clip was posted!" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles: nil] show];
         } else {
             [[[UIAlertView alloc] initWithTitle:@"Error!" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles: nil] show];
         }
     }];

Thanks, any help will be appreciated

EDITED:

It seems to add a place, need to do an update after creating a video https://developers.facebook.com/docs/graph-api/reference/v2.3/video#Updating

But though I can update title, description, etc. It was impossible to add a place

EDITED 2:

I needed to add that permission user_videos.
Now the response is success, but I do not see reflected the location in the video post