Skip to content

Instantly share code, notes, and snippets.

@mdobson
Last active December 14, 2015 22:59
Show Gist options
  • Save mdobson/5162194 to your computer and use it in GitHub Desktop.
Save mdobson/5162194 to your computer and use it in GitHub Desktop.
Geolocation queries in UserGrid
UGQuery * query = [[UGQuery alloc] init];
//This performs a geolocation query on the App Services platform.
//Note that geolocation queries are no different then other queries that can be performed
//on the App Services platform
[query addRequiredWithin:@"restaurants" latitude:37.776753 longitude:-122,407846 distance:16093.00];
//An alternate way to perform this query is to use the SDK method that takes a CLLocation object.
//Set up the CLLocation object with a lat and lon, and simply pass it into the SDK Method
CLLocation *myLocation = [[CLLocation alloc] initWithLatitude:37.776753 longitude:-122.407846];
[query addRequiredWithinLocation:@"restaurants" location:myLocation distance:16093.00];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment