我是Foursquare API的新手,在当前位置,我无法弄清楚如何到达附近的地方?我看了很多关于这个的样本,但我无法使它工作。
答案 0 :(得分: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];
}