首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >iOS脸书状态位置

iOS脸书状态位置
EN

Stack Overflow用户
提问于 2012-02-01 23:40:03
回答 2查看 2.7K关注 0票数 16

我对如何使用用户状态中的位置感到困惑。我看到有一个位置字段,但我不知道如何使用它。指令只是说了一个对象,它根本没有指定它想要什么对象以及它想要什么格式。有没有人可以帮我张贴一个有位置的状态?

这是我现在的代码:

代码语言:javascript
复制
- (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];
}
EN

回答 2

Stack Overflow用户

发布于 2012-08-31 15:27:34

添加地点时,需要提供Facebook目前已知的地点ID。为此,您可以获取最近的位置,它也返回ID,然后添加您想要的位置作为位置。

票数 0
EN

Stack Overflow用户

发布于 2013-01-24 17:14:12

要测试这一点,您可以尝试在此处,在字段中粘贴此行示例"search?q=spa&type=place¢er=40.7167,-74& distance=1000“

代码语言:javascript
复制
then you will see results like 
{
  "data": [
    {
      "location": {
        "street": "221 Canal Street, Room 301", 
        "city": "New York", 
        "state": "NY", 
        "country": "United States", 
        "zip": "10013", 
        "latitude": 40.71761, 
        "longitude": -73.99933
      }, 
      "category": "Spas/beauty/personal care", 
      "name": "CiCi Beauty Spa", 
      "id": "180068255444372"
    }, 

etc...

you can then post status like 
("message", "im here guys"); // your message
("place", "180068255444372"); // the id of the place 

in the tool field "me/feed"

在工具中,将方法更改为POST,然后为"message“和"place”添加字段参数以测试它。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9098660

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档