Places SDK for iOS quick reference

The Places SDK for iOS lets iOS apps get information about places (businesses, points of interest, geographic locations) through Place Details, Place Photos, Text Search, Nearby Search, and Autocomplete. Places API (New) is the current version of the SDK.

Places SDK for iOS: key facts

  • Product: Places SDK for iOS
  • Also known as: Places SDK for iOS (New)
  • Category: Places
  • Platform: iOS
  • Runs on: Client (app or browser code)
  • Launch stage: GA
  • Lifecycle: Active
  • Overview: Places SDK for iOS overview

Places SDK for iOS: when to use it

Use Places SDK for iOS when:

  • You need place details, photos, Text Search, or Nearby Search results inside a native iOS app.
  • You need place name or address autocomplete as users type in an iOS app.
  • You want prebuilt Places UI Kit components (place details, search, autocomplete) in an iOS app.

Don't use Places SDK for iOS when:

Places SDK for iOS: setup

Official Places SDK for iOS packages:

  • swift_package: https://github.com/googlemaps/ios-places-sdk (GooglePlaces, GooglePlacesSwift)

Places SDK for iOS: common mistakes

  • Problem: Places SDK for iOS (New) calls fail if Places API (New) isn't enabled in the Cloud project or isn't on the API key's list of authorized APIs. Fix: Enable Places API (New) and add it to the API key restrictions used by the app. See /maps/documentation/places/ios-sdk/legacy/migrate-overview.
  • Problem: kGMSPlacesRateLimitExceeded (-7) means the API key exceeded its usage rate limit; apps on turned-off SDK 2.x versions (turned off July 29, 2019) also receive this error. Fix: Check quota and usage for Places API (New) in the Google Cloud console, and update apps on SDK versions earlier than 3.0. See /maps/documentation/places/ios-sdk/reference/objc/Enums/GMSPlacesErrorCode.
  • Problem: Session tokens reused across apps in the same project, or across sessions, break autocomplete session billing grouping. Fix: Generate a unique session token (version 4 UUID recommended) per autocomplete session; tokens must be unique per project. See /maps/documentation/places/ios-sdk/use-session-tokens.
  • Problem: Apps display place data without the attributions returned by the API. Fix: Show all relevant attributions returned with Places data, per the policies page. See /maps/documentation/places/ios-sdk/overview.
  • Problem: Attaching .onTap after .onPlaceAnalyticsEvent or another generic SwiftUI View modifier on a Places UI Kit view fails because .onTap is defined on the component type rather than View. Fix: Chain .onTap directly on the Places UI Kit view (such as PlaceDetailsCompactView or AdvancedPlaceDetailsCompactView) before any generic View modifiers like .onPlaceAnalyticsEvent. See /maps/documentation/places/ios-sdk/places-ui-kit-analytics.
  • Problem: Places UI Kit views with invalid, expired (>10 minutes), or cross-project contentTokens load and bill at standard rates without an error, the SDK doesn't store tokens across requests or accept them on PlaceIdentifier.coordinate, and AdvancedPlaceListView sends no tokens if any query lacks a non-empty place ID or resource name. Fix: On GooglePlacesSwift 11.4.0+, pass contentTokens (up to 100 tokens, 2,048 UTF-8 bytes each) from the same Cloud project via .placeIDWithTokens(_:contentTokens:) or .resourceNameWithTokens(_:contentTokens:) on each PlaceDetailsQuery or PlaceMarker within 10 minutes, ensuring every query in AdvancedPlaceListView has a valid ID. See /maps/ai/agentic-data-visualization-token.

Places SDK for iOS: legacy and deprecated features

  • Places SDK for iOS (legacy version): Legacy since 2025-03-01. Replacement: Places SDK for iOS (New) (requires Places API (New)). Symptom: Legacy classes and methods (for example fetchPlaceFromPlaceID, GMSAutocompleteFetcher, and GMSAutocompleteViewController) don't exist in SDK 11.0.0 and later, breaking compilation. See the migration guide.
  • GMSAutocompleteResultsViewController setAutocompleteBoundsUsingNorthEastCorner:SouthWestCorner and GMSAutocompleteFetcher initWithBounds:filter: Decommissioned since 2020-10-13. Replacement: GMSAutocompleteFilter (locationBias or locationRestriction) on GMSAutocompleteRequest with GMSPlacesClient fetchAutocompleteSuggestionsFromRequest:callback:, or the GooglePlacesSwift placeAutocomplete or basicPlaceAutocomplete modifiers for a UI widget. Symptom: Methods don't exist in SDK 4.0.0 and later (and GMSAutocompleteResultsViewController and GMSAutocompleteFetcher were removed in SDK 11.0.0). See the migration guide.
  • GMSCoordinateBounds-based autocomplete bounds (GMSAutocompleteViewController.autocompleteBounds/autocompleteBoundsMode; bounds/boundsMode params of findAutocompletePredictionsFromQuery and autocompleteQuery): Decommissioned since 2020-10-13. Replacement: GMSAutocompleteRequest with GMSAutocompleteFilter (locationBias or locationRestriction) and GMSPlacesClient fetchAutocompleteSuggestionsFromRequest:callback:, or the GooglePlacesSwift placeAutocomplete or basicPlaceAutocomplete modifiers for a UI widget. Symptom: Properties and parameters don't exist in SDK 4.0.0 and later (and GMSAutocompleteViewController and findAutocompletePredictionsFromQuery were removed in SDK 11.0.0). See the migration guide.
  • GMSPlace.openNowStatus: Decommissioned since 2020-10-13. Replacement: GMSPlacesClient isOpenWithRequest:callback: (GMSPlaceIsOpenRequest) or PlacesClient.isPlaceOpen(with:) in GooglePlacesSwift. Symptom: Property doesn't exist in SDK 4.0.0 and later. See the migration guide.
  • GMSPlaceField as NS_ENUM: Decommissioned since 2020-10-13. Replacement: GMSPlaceProperty constants with request classes such as GMSFetchPlaceRequest and GMSPlaceSearchByTextRequest, or PlaceProperty in GooglePlacesSwift. Symptom: Replaced by NS_OPTIONS in SDK 4.0.0 (GMSPlaceField as NS_OPTIONS belongs to the legacy API and doesn't exist in SDK 11.0.0 and later). See the migration guide.
  • Places SDK for iOS version 2.7.0: Decommissioned since 2019-07-29. Replacement: Current Places SDK for iOS version. Symptom: kGMSPlacesRateLimitExceeded errors.

What you can do with Places SDK for iOS

See the guides linked below for each task, or compare across products in the Capabilities Explorer.

Places SDK for iOS: Generative AI

Places SDK for iOS: Places

Places SDK for iOS: Places UI Kit

  • Apply CSS styling to a place data UI element. Note: CSS custom properties apply to Maps JavaScript API Places UI Kit elements; Places SDK for Android and Places SDK for iOS style Place UI Kit views programmatically using theme and style attributes. EEA COMPLIANCE REQUIREMENT: For showing place data on a map in the European Economic Area (EEA), do not call Places API web services from a backend server. Use client-side Places UI Kit components on the target platform (Maps JavaScript API on web, Places SDK for Android on Android, or Places SDK for iOS on iOS). See the EEA requirements and FAQ.
  • Customize place data UI element styling and configurations with a UI element customization tool. Note: EEA COMPLIANCE REQUIREMENT: For showing place data on a map in the European Economic Area (EEA), do not call Places API web services from a backend server. Use client-side Places UI Kit components on the target platform (Maps JavaScript API on web, Places SDK for Android on Android, or Places SDK for iOS on iOS). See the EEA requirements and FAQ.
  • Add a UI element that displays information about a specific place to a web page or mobile app. Note: On web (Maps JavaScript API), use gmp-place-details, gmp-place-details-compact, gmp-advanced-place-details, or gmp-advanced-place-details-compact. On Android (Places SDK for Android), use PlaceDetailsFragment, PlaceDetailsCompactFragment, AdvancedPlaceDetailsFragment, or AdvancedPlaceDetailsCompactFragment for Views, or the AdvancedPlaceDetails and AdvancedPlaceDetailsCompact Jetpack Compose @Composable functions. On iOS (Places SDK for iOS), use PlaceDetailsView, PlaceDetailsCompactView, AdvancedPlaceDetailsView, or AdvancedPlaceDetailsCompactView. EEA COMPLIANCE REQUIREMENT: For showing place data on a map in the European Economic Area (EEA), do not call Places API web services from a backend server. Use client-side Places UI Kit components on the target platform (Maps JavaScript API on web, Places SDK for Android on Android, or Places SDK for iOS on iOS). See the EEA requirements and FAQ.
  • Add a customizable place details UI element with configurable action buttons and filtered reviews and media to a web page or mobile app. Note: Bills the Places UI Kit Pro SKU. On web (Maps JavaScript API), use gmp-advanced-place-details (AdvancedPlaceDetailsElement) or gmp-advanced-place-details-compact (AdvancedPlaceDetailsCompactElement). On Android (Places SDK for Android), use the Jetpack Compose @Composable functions AdvancedPlaceDetails (vertical full layout, supporting SearchReviewsOptions and SearchMediaOptions) and AdvancedPlaceDetailsCompact (vertical or horizontal compact layout, supporting SearchMediaOptions and custom content slots via the slots lambda (basicSectionTop and basicSectionBottom)), or the Fragment views AdvancedPlaceDetailsFragment and AdvancedPlaceDetailsCompactFragment; hiding the place name (omitting NAME from content) is supported on the composables. On iOS (Places SDK for iOS), use AdvancedPlaceDetailsView or AdvancedPlaceDetailsCompactView (custom content slots via placeDetailsCompactContentSlot are supported on AdvancedPlaceDetailsCompactView). EEA COMPLIANCE REQUIREMENT: For showing place data on a map in the European Economic Area (EEA), do not call Places API web services from a backend server. Use client-side Places UI Kit components on the target platform (Maps JavaScript API on web, Places SDK for Android on Android, or Places SDK for iOS on iOS). See the EEA requirements and FAQ.
  • Add a UI element that displays a list of places based on a query string to a web page. Note: Supported on both web pages (Maps JavaScript API) and mobile apps (Places SDK for Android and Places SDK for iOS). EEA COMPLIANCE REQUIREMENT: For showing place data on a map in the European Economic Area (EEA), do not call Places API web services from a backend server. Use client-side Places UI Kit components on the target platform (Maps JavaScript API on web, Places SDK for Android on Android, or Places SDK for iOS on iOS). See the EEA requirements and FAQ.
  • Add a UI element that displays a list of places near a specific location to a web page. Note: Supported on both web pages (Maps JavaScript API) and mobile apps (Places SDK for Android and Places SDK for iOS). EEA COMPLIANCE REQUIREMENT: For showing place data on a map in the European Economic Area (EEA), do not call Places API web services from a backend server. Use client-side Places UI Kit components on the target platform (Maps JavaScript API on web, Places SDK for Android on Android, or Places SDK for iOS on iOS). See the EEA requirements and FAQ.
  • Add a basic autocomplete UI element to a web page or app that returns Google Place identifiers based on a query string. Note: EEA COMPLIANCE REQUIREMENT: For showing place data on a map in the European Economic Area (EEA), do not call Places API web services from a backend server. Use client-side Places UI Kit components on the target platform (Maps JavaScript API on web, Places SDK for Android on Android, or Places SDK for iOS on iOS). See the EEA requirements and FAQ.
  • Subscribe to analytics events from user interactions with place data UI elements. Note: Analytics events are intended for telemetry and analytics rather than critical UI navigation, because callback timing is not guaranteed to be synchronous and events or tags may change over time. On web (Maps JavaScript API), add a gmp-analytics event listener to Settings.getInstance(). On Android (Places SDK for Android), wrap Places UI Kit composables (AdvancedPlaceDetails or AdvancedPlaceDetailsCompact) in ProvidePlacesAnalyticsHandler. On iOS (Places SDK for iOS), attach the onPlaceAnalyticsEvent modifier to a Places UI Kit view or parent container.
  • Respond to user taps on a place data UI element. Note: Supported on Android and iOS only (not supported on web). Card tap callbacks pass a Place containing the place ID, coordinates, and viewport bounds for UI actions such as centering a map or opening full place details. On Android, pass the onClick parameter to Places UI Kit composables (AdvancedPlaceDetails or AdvancedPlaceDetailsCompact). On iOS, attach the onTap modifier directly to the Places UI Kit view before generic SwiftUI View modifiers.
  • Display place data UI elements with a grounding content token from an AI agent response. Note: Only search_places and search_along_route from Maps Experience agent tools (mapstools.googleapis.com) issue contentToken (not Grounding with Google Maps). Tokens waive Places UI Kit charges for 10 minutes on supported components under the same Cloud project; invalid or expired tokens bill at standard rates without an error.