Skip to content

Instantly share code, notes, and snippets.

@arturlector
Last active March 15, 2016 14:05
Show Gist options
  • Save arturlector/366cc18eb77318b70b2e to your computer and use it in GitHub Desktop.
Save arturlector/366cc18eb77318b70b2e to your computer and use it in GitHub Desktop.
Google Places. Get places by current coordinate.

Google Places.

Get places by current coordinate

- (void)getNearbyPlaces
{
   [self.placesClient currentPlaceWithCallback:^(GMSPlaceLikelihoodList * _Nullable likelihoodList, NSError * _Nullable error) {
       
   if (error != nil) {
        NSLog(@"Current Place error %@", [error localizedDescription]);
        return;   
   }
       
   for (GMSPlaceLikelihood *likelihood in likelihoodList.likelihoods) {
         GMSPlace* place = likelihood.place;
         NSLog(@"Current Place name %@ at likelihood %g", place.name, likelihood.likelihood);
         NSLog(@"Current Place address %@", place.formattedAddress);
         NSLog(@"Current Place attributions %@", place.attributions);
         NSLog(@"Current PlaceID %@", place.placeID);
   }
       
   NSLog(@"likelihoodList = %@", likelihoodList);
   }];
}
self.placesClient = [GMSPlacesClient sharedClient];

###Ccылка на Google Places:

https://developers.google.com/places/ios-api/start#add-a-place-picker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment