Skip to content

Instantly share code, notes, and snippets.

@emilepetrone
Created October 11, 2011 17:33
Show Gist options
  • Save emilepetrone/1278773 to your computer and use it in GitHub Desktop.
Save emilepetrone/1278773 to your computer and use it in GitHub Desktop.
// find the ten nearest records, created within the past 24 hours, within two kilometers of an address
SGStorageQuery *query = [SGStorageQuery queryWithAddress:@"41 Decatur St, San Francisco, CA"
layer:@"com.simplegeo.example"];
[query setRadius:2.0];
[query setLimit:10];
[query setDateRangeFrom:[NSDate dateWithTimeIntervalSinceNow:-86400]
to:[NSDate date]];
[client getRecordsForQuery:query
callback:[SGCallback callbackWithSuccessBlock:
^(id response) {
// you've got records!
// to create an array of SGStoredRecord objects...
NSArray *records = [NSArray arrayWithSGCollection:response
type:SGCollectionTypeRecords];
} failureBlock:^(NSError *error) {
// handle failure
}]];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment