How to get country specific result with Google autocomplete place api ios sdk?

前端 未结 5 1378
后悔当初
后悔当初 2020-12-16 00:36

I\'m using below method to get autocomplete result for input string of GMSPlacesClient class:

- (void)autocompleteQuery:(NSString *)query
               boun         


        
5条回答
  •  醉梦人生
    2020-12-16 01:08

    This one work for me

    let placesClient = GMSPlacesClient()
        let filter = GMSAutocompleteFilter()
        filter.type = .Establishment
        filter.country = "SG"
        placesClient.autocompleteQuery(searchString, bounds: nil, filter: filter) { (results, error:NSError?) -> Void in
          self.resultsArray.removeAll()
          if let _ = results {
            for result in results!{
              if let res: GMSAutocompletePrediction = result {
               // your code
              }
            }
          }
        }
    

提交回复
热议问题