Created
October 11, 2011 17:43
-
-
Save emilepetrone/1278818 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// find the three nearest Italian restaurants within five kilometers of an address | |
SGPlacesQuery *query = [SGPlacesQuery queryWithAddress:@"41 Decatur St, San Francisco, CA"]; | |
[query setCategories:[NSArray arrayWithObjects:SGPlacesCategoryRestaurant, SGPlacesCategoryFood, nil]]; | |
[query setSearchString:@"Italian"]; | |
[query setRadius:5.0]; | |
[query setLimit:3]; | |
[client getPlacesForQuery:query | |
callback:[SGCallback callbackWithSuccessBlock: | |
^(id response) { | |
// you've got Places! | |
// to create an array of SGPlace objects... | |
NSArray *places = [NSArray arrayWithSGCollection:response | |
type:SGCollectionTypePlaces]; | |
} failureBlock:^(NSError *error) { | |
// handle failure | |
}]]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment