3

我是 Foursquare API 的新手,在给定当前位置的情况下,我不知道如何获取附近的地方?我看了很多关于这个的样本,但我无法让它发挥作用。

4

1 回答 1

3

看到这个链接https://github.com/Constantine-Fry/Foursquare-API-v2/tree/master/Foursquare2-iOS。为 iPhone 集成foursquare API 很容易。我用过这个。

例如:地点搜索

[Foursquare2 searchVenuesNearByLatitude:@"40.763" longitude:@"-73.990" accuracyLL:nil altitude:nil accuracyAlt:nil query:@"" limit:@"15" intent:@"" callback:^(BOOL success, id result){
            if (success) {
             //parse here
             tableData = [[FoursquareParser parseSearchVenuesResultsDictionary:(NSDictionary*)result] retain];
            [mTableView reloadData];
           }
        }];

//搜索场地解析器

 +(NSMutableArray*)parseSearchVenuesResultsDictionary:(NSDictionary*)result{
    NSArray *groupsArray = [[result objectForKey:@"response"] objectForKey:@"venues"];
    if([groupsArray count] > 0){

            NSMutableArray *resultArray = [NSMutableArray array];
    //Get Stats details
                NSDictionary *stats = [[groupsArray objectAtIndex:i] objectForKey:@"stats"];
                [resultDictionary setObject:[stats objectForKey:@"checkinsCount"] forKey:@"checkinsCount"];
                [resultDictionary setObject:[stats objectForKey:@"tipCount"] forKey:@"tipCount"];
                [resultDictionary setObject:[stats objectForKey:@"usersCount"] forKey:@"usersCount"];

                [resultArray addObject:resultDictionary];
                return resultArray;
        }
        return [NSMutableArray array];
    }
于 2012-06-06T09:02:44.400 回答