在Facebook中添加当前位置发布视频

时间:2015-12-17 16:54:58

标签: ios facebook facebook-graph-api video share

我需要使用place密钥在Fac​​ebook的帖子中发送位置。 如图所示here

起初我以为我必须将纬度和经度的物体发送到一个叫做钥匙的位置。

然后我意识到你必须发送一个place密钥place_id

管理以使用此

获取最近的place_id
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);
    }];

因此,当我尝试使用/me/videos发送包含该位置的帖子时,会出现错误。

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

这是我的代码。

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];
         }
     }];

谢谢,任何帮助将不胜感激

编辑:

似乎添加了一个地方,需要在创建视频后进行更新 https://developers.facebook.com/docs/graph-api/reference/v2.3/video#Updating

但是我可以更新标题,描述等。添加地点是不可能的

已编辑2:

我需要添加该权限user_videos 现在响应成功,但我没有看到反映视频帖子中的位置

0 个答案:

没有答案