Skip to content

Instantly share code, notes, and snippets.

@arielelkin
Last active December 18, 2015 03:29
Show Gist options
  • Save arielelkin/5718605 to your computer and use it in GitHub Desktop.
Save arielelkin/5718605 to your computer and use it in GitHub Desktop.
LocoQuizz functions
-(void)createVenuesDict:(NSArray *)allVenues{
venuesDict = [NSMutableDictionary dictionary];
//Only get the venues' names and categories
for(NSDictionary *singleVenue in allVenues){
NSArray *categories = [singleVenue valueForKey:@"categories"];
if(categories){
[self.venuesDict setValue:[categories valueForKey:@"name"][0] forKey:[singleVenue valueForKey:@"name"]];
}
}
NSLog(@"venues: %@", self.venuesDict);
[self nextQuestion];
}
-(void)fetchGameContent{
//get the base URL string
NSString *baseString = @"https://api.foursquare.com/v2/venues/search";
//make our query string
NSString *queryString = [NSString stringWithFormat:@"?ll=%f,%f", self.userLocation.latitude, self.userLocation.longitude];
//add the API Keys
NSString *apiKeyString = [NSString stringWithFormat:@"&client_id=CPG1OA2FD0OE43PLES4MFOK133GSJADXF3DUMLO4CG0TKOEV&client_secret=30UCWAOGHIVF1C3MSUQ1RNPEUBKO20S01DQCWUQ0LEKCNE4D&v=20130126"];
//concatenate all strings:
NSString *requestString = [[baseString stringByAppendingString:queryString] stringByAppendingString:apiKeyString];
// NSLog(@"I got: %@", requestString);
//make a NSURLRequest
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:requestString]];
//Fetch the data!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment