I'm new to Foursquare API and I couldn't figure out how to get nearby places given the current location? I looked at a lot of samples about this but I couldn't make it work.
Asked
Active
Viewed 4,143 times
3
-
1What was wrong with the samples you looked at? What didn't work? What did you try? Show what you have tried, explain what didn't work (and in what way it didn't work) and describe what you tried to do to get it to work. Asking a question as you have done sounds like you want someone to do your work for you because you have tried doing stuff yourself.... – Nick Bull Jun 06 '12 at 08:32
1 Answers
3
see this link https://github.com/Constantine-Fry/Foursquare-API-v2/tree/master/Foursquare2-iOS . It's easy to integrate the foursquare API for iPhone. I have used this one.
For example:Place Search
[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];
}
}];
//Search Venues Parser
+(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];
}

Raj Subbiah
- 1,292
- 11
- 20
-
-
You can parse the result object. Ex: tableData = [FoursquareParser parseSearchVenuesResultsDictionary:(NSDictionary*)result]; [mTableView reloadData]; – Raj Subbiah Jun 07 '12 at 06:01
-
What is the tableData type? Where FoursquareParser declared in? – Gokhan Gultekin Jun 07 '12 at 07:27
-
tableData is my table data source(nsmutablearray). FoursquareParser is my own parser class. You can also write your own parser. – Raj Subbiah Jun 08 '12 at 07:14
-