# GMSPlacesClient

    @interface GMSPlacesClient : NSObject

Main interface to the Places SDK. Used for searching and getting details about places. This class
should be accessed through the `[GMSPlacesClient sharedClient]` method.

`GMSPlacesClient` methods should only be called from the main thread. Calling these methods from
another thread will result in an exception or undefined behavior. Unless otherwise specified, all
callbacks will be invoked on the main thread.
- `


  ### [+sharedClient](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#/c:objc(cs)GMSPlacesClient(cm)sharedClient)


  ` Provides the shared instance of `GMSPlacesClient` for the Google Places SDK for iOS, creating it
  if necessary.

  If your application often uses methods of `GMSPlacesClient` it may want to hold onto this object
  directly, as otherwise your connection to Google may be restarted on a regular basis.

  #### Declaration

  Swift

      class func shared() -> Self

  Objective-C

      + (nonnull instancetype)sharedClient;

- `


  ### [+provideAPIKey:](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#/c:objc(cs)GMSPlacesClient(cm)provideAPIKey:)


  ` Provides your API key to the Google Places SDK for iOS. This key is generated for your
  application via the Google Cloud Platform Console, and is paired with your application's
  bundle ID to identify it. This should be called by your application before using
  `GMSPlacesClient` (e.g., in `application:didFinishLaunchingWithOptions:`).

  #### Declaration

  Swift

      class func provideAPIKey(_ key: String) -> Bool

  Objective-C

      + (BOOL)provideAPIKey:(nonnull NSString *)key;

  #### Return Value

  YES if the APIKey was successfully provided.
- `


  ### [+setAppCheckTokenProvider:](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#/c:objc(cs)GMSPlacesClient(cm)setAppCheckTokenProvider:)


  ` Provides an App Check token provider to the Google Places SDK for iOS. This should be called by
  your application before using `GMSPlacesClient`
  (for example, in `application:didFinishLaunchingWithOptions:`). If you do not provide a token
  provider, the SDK will not use the token provider.

  #### Declaration

  Swift

      class func setAppCheckTokenProvider(_ provider: any https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Protocols/GMSPlacesAppCheckTokenProvider.html)

  Objective-C

      + (void)setAppCheckTokenProvider:
          (nonnull id<https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Protocols/GMSPlacesAppCheckTokenProvider.html>)provider;

- `


  ### [+openSourceLicenseInfo](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#/c:objc(cs)GMSPlacesClient(cm)openSourceLicenseInfo)


  ` Returns the open source software license information for the Google Places SDK for iOS. This
  information must be made available within your application.

  #### Declaration

  Swift

      class func openSourceLicenseInfo() -> String

  Objective-C

      + (nonnull NSString *)openSourceLicenseInfo;

- `


  ### [+SDKVersion](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#/c:objc(cs)GMSPlacesClient(cm)SDKVersion)


  ` Returns the version for this release of the Google Places SDK for iOS.. For example, "1.0.0".

  #### Declaration

  Swift

      class func sdkVersion() -> String

  Objective-C

      + (nonnull NSString *)SDKVersion;

- `


  ### [+SDKLongVersion](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#/c:objc(cs)GMSPlacesClient(cm)SDKLongVersion)


  ` Returns the long version for this release of the Google Places SDK for iOS.. For example, "1.0.0
  (102.1)".

  #### Declaration

  Swift

      class func sdkLongVersion() -> String

  Objective-C

      + (nonnull NSString *)SDKLongVersion;

- `


  ### [-isOpenWithRequest:callback:](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#/c:objc(cs)GMSPlacesClient(im)isOpenWithRequest:callback:)


  ` Gets the open status for a place.

  Gets details for a place including all properties necessary to determine `https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Enums/GMSPlaceOpenStatus.html` at
  the specified `NSDate`.

  This method is non-blocking.

  **NOTE:** It is best practice to check that opening hours are not null before passing in a
  `https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlace.html` (with opening hours already requested) to `https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceIsOpenRequest.html`. In some cases, a
  place may not have any opening hours data available. If a place request with the opening hours
  property has already been made, and opening hours are null, calling this method using the place
  response object will result in another billable event.

  #### Declaration

  Swift

      func isOpen(with isOpenRequest: https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceIsOpenRequest.html, callback: @escaping https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions/GMSPlaceOpenStatusResponseCallback.html)

  Objective-C

      - (void)isOpenWithRequest:(nonnull https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceIsOpenRequest.html *)isOpenRequest
                       callback:(nonnull https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions/GMSPlaceOpenStatusResponseCallback.html)callback;

  #### Parameters

  |---|---|
  | ` isOpenRequest ` | The request to determine the open status for a given place. |
  | ` callback ` | The callback to invoke with the open status response. |

- `


  ### [-searchByTextWithRequest:callback:](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#/c:objc(cs)GMSPlacesClient(im)searchByTextWithRequest:callback:)


  ` Deprecated

  This method is replaced by `searchByTextWithRequest:completion:` and will be removed in a future release.
  Search for places by text and restrictions. This method is non-blocking.

  #### Declaration

  Swift

      func searchByText(with textSearchRequest: https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceSearchByTextRequest.html, callback: @escaping https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions/GMSPlaceSearchByTextResultCallback.html)

  Objective-C

      - (void)searchByTextWithRequest:
                  (nonnull https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceSearchByTextRequest.html *)textSearchRequest
                             callback:
                                 (nonnull https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions/GMSPlaceSearchByTextResultCallback.html)callback;

  #### Parameters

  |---|---|
  | ` textSearchRequest ` | `https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceSearchByTextRequest.html` The text request to use for the query. |
  | ` callback ` | The callback to invoke with the lookup result. |

- `


  ### [-fetchAutocompleteSuggestionsFromRequest:callback:](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#/c:objc(cs)GMSPlacesClient(im)fetchAutocompleteSuggestionsFromRequest:callback:)


  ` Find Autocomplete suggestions from text query. Results may optionally be biased towards a
  certain location or restricted to an area. This method is non-blocking.

  The supplied callback will be invoked with an array of autocompletion suggestions upon success
  and an `NSError` upon an error.

  #### Declaration

  Swift

      func fetchAutocompleteSuggestions(from request: https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSAutocompleteRequest.html, callback: @escaping https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions/GMSAutocompleteSuggestionsCallback.html)

  Objective-C

      - (void)
          fetchAutocompleteSuggestionsFromRequest:
              (nonnull https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSAutocompleteRequest.html *)request
                                         callback:
                                             (nonnull
                                                  https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions/GMSAutocompleteSuggestionsCallback.html)
                                                 callback;

  #### Parameters

  |---|---|
  | ` request ` | The `https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSAutocompleteRequest.html` request for autocomplete. |
  | ` callback ` | The callback to invoke with the suggestions. |

- `


  ### [-fetchPlaceWithRequest:callback:](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#/c:objc(cs)GMSPlacesClient(im)fetchPlaceWithRequest:callback:)


  ` Get a place using a request object. This method is non-blocking.

  #### Declaration

  Swift

      func fetchPlace(with fetchPlaceRequest: https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSFetchPlaceRequest.html, callback: @escaping https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions/GMSPlaceResultCallback.html)

  Objective-C

      - (void)fetchPlaceWithRequest:(nonnull https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSFetchPlaceRequest.html *)fetchPlaceRequest
                           callback:(nonnull https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions/GMSPlaceResultCallback.html)callback;

  #### Parameters

  |---|---|
  | ` fetchPlaceRequest ` | `https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSFetchPlaceRequest.html` The fetch place request to use for the query. |
  | ` callback ` | The callback to invoke with the place result. |

- `


  ### [-fetchPhotoWithRequest:callback:](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#/c:objc(cs)GMSPlacesClient(im)fetchPhotoWithRequest:callback:)


  ` Deprecated

  This API is deprecated, please use the Place Details component (<https://developers.google.com/maps/documentation/places/ios-sdk/place-details-ui-kit>) instead.
  Request a photo using fetch photo request. This method is non-blocking.

  #### Declaration

  Swift

      func fetchPhoto(with fetchPhotoRequest: https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSFetchPhotoRequest.html, callback: @escaping https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions/GMSFetchPhotoResultCallback.html)

  Objective-C

      - (void)fetchPhotoWithRequest:(nonnull https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSFetchPhotoRequest.html *)fetchPhotoRequest
                           callback:(nonnull https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions/GMSFetchPhotoResultCallback.html)callback;

  #### Parameters

  |---|---|
  | ` fetchPhotoRequest ` | `https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSFetchPhotoRequest.html` The photo request to use. |
  | ` callback ` | The callback to invoke with the `NSURL` result. |

- `


  ### [-searchNearbyWithRequest:callback:](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#/c:objc(cs)GMSPlacesClient(im)searchNearbyWithRequest:callback:)


  ` Deprecated

  This method is replaced by `searchNearbyWithRequest:completion:` and will be removed in a future release.
  Search for places near a location and restriction. This method is non-blocking.

  #### Declaration

  Swift

      func searchNearby(with searchNearbyRequest: https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceSearchNearbyRequest.html, callback: @escaping https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions/GMSPlaceSearchNearbyResultCallback.html)

  Objective-C

      - (void)searchNearbyWithRequest:
                  (nonnull https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceSearchNearbyRequest.html *)searchNearbyRequest
                             callback:
                                 (nonnull https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions/GMSPlaceSearchNearbyResultCallback.html)callback;

  #### Parameters

  |---|---|
  | ` searchNearbyRequest ` | `https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceSearchNearbyRequest.html` The search nearby request to use for the query. |
  | ` callback ` | The callback to invoke with the lookup result. |

- `


  ### [-searchByTextWithRequest:completion:](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#/c:objc(cs)GMSPlacesClient(im)searchByTextWithRequest:completion:)


  ` Search for places by text and restrictions. This method is non-blocking.

  #### Declaration

  Swift

      func searchByText(with textSearchRequest: https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceSearchByTextRequest.html) async throws -> https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceSearchByTextResponse.html

  Objective-C

      - (void)searchByTextWithRequest:
                  (nonnull https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceSearchByTextRequest.html *)textSearchRequest
                           completion:
                               (nonnull https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions/GMSPlaceSearchByTextResponseCallback.html)callback;

  #### Parameters

  |---|---|
  | ` textSearchRequest ` | `https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceSearchByTextRequest.html` The text request to use for the query. |
  | ` callback ` | The callback to invoke with the search response. |

- `


  ### [-searchNearbyWithRequest:completion:](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#/c:objc(cs)GMSPlacesClient(im)searchNearbyWithRequest:completion:)


  ` Search for places near a location and restriction. This method is non-blocking.

  #### Declaration

  Swift

      func searchNearby(with searchNearbyRequest: https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceSearchNearbyRequest.html) async throws -> https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceSearchNearbyResponse.html

  Objective-C

      - (void)searchNearbyWithRequest:
                  (nonnull https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceSearchNearbyRequest.html *)searchNearbyRequest
                           completion:
                               (nonnull https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions/GMSPlaceSearchNearbyResponseCallback.html)callback;

  #### Parameters

  |---|---|
  | ` searchNearbyRequest ` | `https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlaceSearchNearbyRequest.html` The search nearby request to use for the query. |
  | ` callback ` | The callback to invoke with the search response. |

- `


  ### [+addInternalUsageAttributionID:](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#/c:objc(cs)GMSPlacesClient(cm)addInternalUsageAttributionID:)


  ` Adds a usage attribution ID to the initializer, which helps Google understand which libraries and
  samples are helpful to developers, such as usage of a marker clustering library.
  To opt out of sending the usage attribution ID, it is safe to delete this function call or
  replace the value with an empty string.

  #### Declaration

  Swift

      class func addInternalUsageAttributionID(_ internalUsageAttributionID: String)

  Objective-C

      + (void)addInternalUsageAttributionID:
          (nonnull NSString *)internalUsageAttributionID;

  #### Parameters

  |---|---|
  | ` internalUsageAttributionId ` | The usage attribution ID to add |