Guest User

Untitled

a guest
Jan 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. // find the ten nearest records, created within the past 24 hours, within two kilometers of an address
  2.  
  3. SGStorageQuery *query = [SGStorageQuery queryWithAddress:@"41 Decatur St, San Francisco, CA"
  4. layer:@"com.simplegeo.example"];
  5.  
  6. [query setRadius:2.0];
  7. [query setLimit:10];
  8. [query setDateRangeFrom:[NSDate dateWithTimeIntervalSinceNow:-86400]
  9. to:[NSDate date]];
  10.  
  11. [client getRecordsForQuery:query
  12. callback:[SGCallback callbackWithSuccessBlock:
  13. ^(id response) {
  14. // you've got records!
  15. // to create an array of SGStoredRecord objects...
  16. NSArray *records = [NSArray arrayWithSGCollection:response
  17. type:SGCollectionTypeRecords];
  18. } failureBlock^(NSError *error) {
  19. // handle failure
  20. }]];
Add Comment
Please, Sign In to add comment