iOS Facebook状态位置

Hom*_*dev 16 location facebook ios

我对如何在用户状态中使用位置感到困惑.我看到有一个场地,但我不知道如何使用它.说明只是说一个对象,它根本没有指定它想要的对象以及它想要的格式.任何人都可以帮我发布一个包含位置的状态吗?

这是我现在的代码:

- (void)postWithMessage:(NSString *)message image:(UIImage *)image location:(CLLocation *)location {
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    NSString *path = @"feed";
    [params setObject:@"status" forKey:@"type"];
    if (message && ![message isEqualToString:@""]) [params setObject:message forKey:@"message"];
    if (image) {
        path = @"me/photos";
        [params setObject:@"photo" forKey:@"type"];
        NSData *imageData = UIImagePNGRepresentation(image);
        [params setObject:imageData forKey:@"source"];
    }
    if (location) {
        //Stole this from iOS hackbook that Facebook wrote, but it wasn't helpful.
        NSString *centerLocation = [[NSString alloc] initWithFormat:@"%f,%f", location.coordinate.latitude, location.coordinate.longitude];
        [params setObject:centerLocation forKey:@"center"];
    }


    [facebook requestWithGraphPath:path andParams:params andHttpMethod:@"POST" andDelegate:self];
}
Run Code Online (Sandbox Code Playgroud)

Ric*_*ett 1

创建流帖子的文档列出了一个参数place,其值为该位置的 Facebook 页面 ID。您可以通过搜索查询地点 FQL 表来找到这些地点 ID 。

在这种情况下,您还应该使用 Graph api 路径me/feed

尽管与您的问题无关,但在if (image)分支中您添加了一个参数type,该参数未在发布照片部分中记录。