3

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.

Chris
  • 44,602
  • 16
  • 137
  • 156
Gokhan Gultekin
  • 291
  • 5
  • 15
  • 1
    What 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 Answers1

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