Swift 3.0でGoogleプレイスを使用してGoogleオートコンプリートを実行しようとしています。しかし、私は現在の場所に応じて検索する必要があります。例:私はインドのカルカッタにいて、検索キーワード「コ」を入力すると、コルカタの結果が最初に表示されます。ローカル検索でスムーズGoogleオートコンプリート
誰でも助けてくれますか? ここに私のコードです。 は、私は私のクラスでGooglePlaces // MARK
@IBAction func txtFieldLocationDidStartEditing(_ sender: Any) {
self.placeAutocomplete()
}
func placeAutocomplete() {
let autocompleteController = GMSAutocompleteViewController()
autocompleteController.delegate = self
present(autocompleteController, animated: true, completion: nil)
}
をインポート: - オートコンプリート代表
func viewController(_ viewController: GMSAutocompleteViewController, didAutocompleteWith place: GMSPlace) {
print("Place name: \(place.name)")
dismiss(animated: true, completion: nil)
}
func viewController(_ viewController: GMSAutocompleteViewController, didFailAutocompleteWithError error: Error) {
// TODO: handle the error.
print("Error: ", error.localizedDescription)
}
// User canceled the operation.
func wasCancelled(_ viewController: GMSAutocompleteViewController) {
dismiss(animated: true, completion: nil)
}
// Turn the network activity indicator on and off again.
func didRequestAutocompletePredictions(_ viewController: GMSAutocompleteViewController) {
UIApplication.shared.isNetworkActivityIndicatorVisible = true
}
func didUpdateAutocompletePredictions(_ viewController: GMSAutocompleteViewController) {
UIApplication.shared.isNetworkActivityIndicatorVisible = false
}
誰も私はそれを解決するために助けてください。 ありがとうございます。
あなたは正常に動作している境界を設定、あなたが@nathanありがとうあなたのMapViewのバウンディングボックス – nathan