GooglePlaces Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
GMSAutocompleteResultsViewControllerDelegate
@protocol GMSAutocompleteResultsViewControllerDelegate <NSObject>
Protocol used by GMSAutocompleteResultsViewController
, to communicate the user’s interaction
with the controller to the application.
-
Called when a place has been selected from the available autocomplete predictions.
-
Called when a non-retryable error occurred when retrieving autocomplete predictions or place
details. A non-retryable error is defined as one that is unlikely to be fixed by immediately
retrying the operation.
Only the following values of GMSPlacesErrorCode
are retryable:
- kGMSPlacesNetworkError
- kGMSPlacesServerError
- kGMSPlacesInternalError
All other error codes are non-retryable.
Parameters
resultsController
|
|
error
|
The NSError that was returned.
|
-
Called when the user selects an autocomplete prediction from the list but before requesting
place details. Returning NO from this method will suppress the place details fetch and
didAutocompleteWithPlace will not be called.
Parameters
resultsController
|
|
prediction
|
|
-
Called once every time new autocomplete predictions are received.
-
Called once immediately after a request for autocomplete predictions is made.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-27 UTC.
[null,null,["Last updated 2025-08-27 UTC."],[[["\u003cp\u003e\u003ccode\u003eGMSAutocompleteResultsViewControllerDelegate\u003c/code\u003e is a protocol used to handle user interactions within \u003ccode\u003eGMSAutocompleteResultsViewController\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt provides callbacks for successful autocomplete selections, errors during the process, and prediction selections.\u003c/p\u003e\n"],["\u003cp\u003eThe delegate also informs when autocomplete predictions are updated or requested.\u003c/p\u003e\n"],["\u003cp\u003eCallbacks offer details like the selected place, prediction, or error encountered, aiding in application logic.\u003c/p\u003e\n"]]],["The `GMSAutocompleteResultsViewControllerDelegate` protocol manages user interactions with the `GMSAutocompleteResultsViewController`. Key actions include: notifying when a user selects a place via `didAutocompleteWithPlace:`, reporting errors via `didFailAutocompleteWithError:`, allowing pre-selection handling with `didSelectPrediction:`, and signaling prediction updates or requests through `didUpdateAutocompletePredictionsForResultsController:` and `didRequestAutocompletePredictionsForResultsController:`. These methods pass event data such as the `resultsController`, `place`, `error`, or `prediction`.\n"],null,["# GooglePlaces Framework Reference\n\nGMSAutocompleteResultsViewControllerDelegate\n============================================\n\n @protocol GMSAutocompleteResultsViewControllerDelegate \u003cNSObject\u003e\n\nProtocol used by [GMSAutocompleteResultsViewController](../Classes/GMSAutocompleteResultsViewController.html), to communicate the user's interaction\nwith the controller to the application.\n- `\n ``\n ``\n `\n\n ### [-resultsController:didAutocompleteWithPlace:](#/c:objc(pl)GMSAutocompleteResultsViewControllerDelegate(im)resultsController:didAutocompleteWithPlace:)\n\n `\n ` \n Called when a place has been selected from the available autocomplete predictions. \n\n #### Declaration\n\n Swift \n\n func resultsController(_ resultsController: ../Classes/GMSAutocompleteResultsViewController.html, didAutocompleteWith place: ../Classes/GMSPlace.html)\n\n Objective-C \n\n - (void)resultsController:\n (nonnull ../Classes/GMSAutocompleteResultsViewController.html *)resultsController\n didAutocompleteWithPlace:(nonnull ../Classes/GMSPlace.html *)place;\n\n #### Parameters\n\n |---------------------------|----------------------------------------------------------------------------------------------------------------------------|\n | ` `*resultsController*` ` | The [GMSAutocompleteResultsViewController](../Classes/GMSAutocompleteResultsViewController.html) that generated the event. |\n | ` `*place*` ` | The [GMSPlace](../Classes/GMSPlace.html) that was returned. |\n\n- `\n ``\n ``\n `\n\n ### [-resultsController:didFailAutocompleteWithError:](#/c:objc(pl)GMSAutocompleteResultsViewControllerDelegate(im)resultsController:didFailAutocompleteWithError:)\n\n `\n ` \n Called when a non-retryable error occurred when retrieving autocomplete predictions or place\n details. A non-retryable error is defined as one that is unlikely to be fixed by immediately\n retrying the operation.\n\n\n Only the following values of [GMSPlacesErrorCode](../Enums/GMSPlacesErrorCode.html) are retryable:\n - kGMSPlacesNetworkError\n - kGMSPlacesServerError\n - kGMSPlacesInternalError\n\n All other error codes are non-retryable. \n\n #### Declaration\n\n Swift \n\n func resultsController(_ resultsController: ../Classes/GMSAutocompleteResultsViewController.html, didFailAutocompleteWithError error: any Error)\n\n Objective-C \n\n - (void)resultsController:\n (nonnull ../Classes/GMSAutocompleteResultsViewController.html *)resultsController\n didFailAutocompleteWithError:(nonnull NSError *)error;\n\n #### Parameters\n\n |---------------------------|----------------------------------------------------------------------------------------------------------------------------|\n | ` `*resultsController*` ` | The [GMSAutocompleteResultsViewController](../Classes/GMSAutocompleteResultsViewController.html) that generated the event. |\n | ` `*error*` ` | The `NSError` that was returned. |\n\n- `\n ``\n ``\n `\n\n ### [-resultsController:didSelectPrediction:](#/c:objc(pl)GMSAutocompleteResultsViewControllerDelegate(im)resultsController:didSelectPrediction:)\n\n `\n ` \n Called when the user selects an autocomplete prediction from the list but before requesting\n place details. Returning NO from this method will suppress the place details fetch and\n didAutocompleteWithPlace will not be called. \n\n #### Declaration\n\n Swift \n\n optional func resultsController(_ resultsController: ../Classes/GMSAutocompleteResultsViewController.html, didSelect prediction: ../Classes/GMSAutocompletePrediction.html) -\u003e Bool\n\n Objective-C \n\n - (BOOL)resultsController:\n (nonnull ../Classes/GMSAutocompleteResultsViewController.html *)resultsController\n didSelectPrediction:(nonnull ../Classes/GMSAutocompletePrediction.html *)prediction;\n\n #### Parameters\n\n |---------------------------|----------------------------------------------------------------------------------------------------------------------------|\n | ` `*resultsController*` ` | The [GMSAutocompleteResultsViewController](../Classes/GMSAutocompleteResultsViewController.html) that generated the event. |\n | ` `*prediction*` ` | The [GMSAutocompletePrediction](../Classes/GMSAutocompletePrediction.html) that was selected. |\n\n- `\n ``\n ``\n `\n\n ### [-didUpdateAutocompletePredictionsForResultsController:](#/c:objc(pl)GMSAutocompleteResultsViewControllerDelegate(im)didUpdateAutocompletePredictionsForResultsController:)\n\n `\n ` \n Called once every time new autocomplete predictions are received. \n\n #### Declaration\n\n Swift \n\n optional func didUpdateAutocompletePredictions(forResultsController resultsController: ../Classes/GMSAutocompleteResultsViewController.html)\n\n Objective-C \n\n - (void)didUpdateAutocompletePredictionsForResultsController:\n (nonnull ../Classes/GMSAutocompleteResultsViewController.html *)resultsController;\n\n #### Parameters\n\n |---------------------------|----------------------------------------------------------------------------------------------------------------------------|\n | ` `*resultsController*` ` | The [GMSAutocompleteResultsViewController](../Classes/GMSAutocompleteResultsViewController.html) that generated the event. |\n\n- `\n ``\n ``\n `\n\n ### [-didRequestAutocompletePredictionsForResultsController:](#/c:objc(pl)GMSAutocompleteResultsViewControllerDelegate(im)didRequestAutocompletePredictionsForResultsController:)\n\n `\n ` \n Called once immediately after a request for autocomplete predictions is made. \n\n #### Declaration\n\n Swift \n\n optional func didRequestAutocompletePredictions(forResultsController resultsController: ../Classes/GMSAutocompleteResultsViewController.html)\n\n Objective-C \n\n - (void)didRequestAutocompletePredictionsForResultsController:\n (nonnull ../Classes/GMSAutocompleteResultsViewController.html *)resultsController;\n\n #### Parameters\n\n |---------------------------|----------------------------------------------------------------------------------------------------------------------------|\n | ` `*resultsController*` ` | The [GMSAutocompleteResultsViewController](../Classes/GMSAutocompleteResultsViewController.html) that generated the event. |"]]