我是 Foursquare API 的新手,我不知道如何在给定当前位置的情况下获取附近的地点?我查看了很多有关此的示例,但无法使其发挥作用。
请参阅此链接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];
}