Se requiere el enmascaramiento de campos. Debes especificar qué campos deseas que se muestren en la respuesta. No hay una lista predeterminada de campos devueltos. Si omites esta lista, los métodos mostrarán un error.
Es una instancia de la nueva clase GMSFetchPlaceRequest que define todos los parámetros de la solicitud, como el ID de lugar y el token de sesión.
Es una devolución de llamada del tipo GMSPlaceResultCallback para controlar la respuesta.
La respuesta contiene una instancia de GMSPlace que incluye detalles sobre el lugar. Los valores de la propiedad types de la instancia GMSPlace ahora se definen en la Tabla A y la Tabla B.
La instancia de respuesta GMSPlace contiene la nueva propiedad reviews del tipo GMSPlaceReview.
Cuando tu app muestre información obtenida de la instancia de GMSPlace, como fotos y opiniones, también deberá mostrar las atribuciones requeridas.
Para obtener más información, consulta la documentación sobre las atribuciones.
La instancia de respuesta GMSPlace contiene las siguientes funciones miembro:
isOpen
calcula si un lugar está abierto en el momento determinado.
isOpenAtDate
calcula si un lugar está abierto en una fecha determinada.
Estas funciones solo están disponibles cuando habilitas el SDK de Places para iOS. No están disponibles cuando habilitas el SDK de Places para iOS (nuevo). Para obtener más información, consulta Cómo elegir la versión del SDK.
Ejemplo de solicitud
Con Place Details (nuevo), realizas una solicitud y pasas todos los parámetros en la instancia GMSFetchPlaceRequest. Este ejemplo también usa una máscara de campo para que la respuesta solo incluya el nombre visible y la URL del sitio web del lugar:
Swift
// A hotel in Saigon with an attribution.letplaceID="ChIJV4k8_9UodTERU5KXbkYpSYs"// Specify the place data types to return.letfields=[GMSPlaceProperty.name,GMSPlaceProperty.website].map{$0.rawValue}// Create the GMSFetchPlaceRequest instance.letfetchPlaceRequest=GMSFetchPlaceRequest(placeID:placeID,placeProperties:fields,sessionToken:nil)client.fetchPlaceWithRequest(fetchPlaceRequest:fetchPlaceRequest,callback:{(place:GMSPlace?,error:Error?)inguardletplace,error==nilelse{return}print("Place found: \(String(describing:place.name))")})
Objective-C
// A hotel in Saigon with an attribution.NSString*placeID=@"ChIJV4k8_9UodTERU5KXbkYpSYs";// Specify the place data types to return.NSArray<NSString*>*fields=@[GMSPlacePropertyName,GMSPlacePropertyWebsite];// Create the GMSFetchPlaceRequest instance.GMSFetchPlaceRequest*fetchPlaceRequest=[[GMSFetchPlaceRequestalloc]initWithPlaceID:placeIDplaceProperties:fieldssessionToken:nil];[placesClientfetchPlaceWithRequest:fetchPlaceRequestcallback:^(GMSPlace*_Nullableplace,NSError*_Nullableerror){if(error!=nil){NSLog(@"An error occurred %@",[errorlocalizedDescription]);return;}else{NSLog(@"Place Found: %@",place.name);NSLog(@"The place URL: %@",place.website);}}];
[null,null,["Última actualización: 2025-08-31 (UTC)"],[],[],null,["# Migrate to Place Details (New)\n\n\u003cbr /\u003e\n\n| This feature requires that you enable Places API (New), the next generation of the Places API. For more information, see [Enable APIs](/maps/documentation/places/ios-sdk/legacy/cloud-setup#enabling-apis).\n\n\u003cbr /\u003e\n\nPlaces SDK for iOS supports\n[Place Details (Legacy)](/maps/documentation/places/ios-sdk/place-details).\nIf you are familiar with Places SDK for iOS (Legacy),\n[Place Details (New)](/maps/documentation/places/ios-sdk/details-place)\nmakes the following changes:\n\n- Uses a new pricing model. For pricing information for all APIs, see\n [Pricing for the Places SDK for iOS (New)](/maps/documentation/places/ios-sdk/usage-and-billing#pricing-new).\n\n- Field masking is required. You must specify which fields you want returned\n in the response. There is no default list of returned fields. If you omit\n this list, the methods return an error.\n\n- To make a request, call the new\n [`GMSPlacesClient fetchPlaceWithRequest:`](/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#-fetchplacewithrequest:callback:)\n method.\n\n- Pass to the request:\n\n - An instance of the new\n [`GMSFetchPlaceRequest`](/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSFetchPlaceRequest)\n class that defines all request parameters, such as the place ID and\n session token.\n\n - A callback of type\n [`GMSPlaceResultCallback`](/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions#/c:GMSPlacesClient.h@T@GMSPlaceResultCallback)\n to handle the response.\n\n- The response contains a\n [`GMSPlace`](/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlace)\n instance containing details about the place. The values in the `types`\n property of the `GMSPlace` instance are now defined by\n [Table A](/maps/documentation/places/ios-sdk/place-types#table-a) and\n [Table B](/maps/documentation/places/ios-sdk/place-types#table-b).\n\n- The response `GMSPlace` instance contains the new `reviews`\n property of type [`GMSPlaceReview`](/maps/documentation/places/ios-sdk/refereference/objc/Classes/GMSPlaceReview).\n When your app displays information obtained from the `GMSPlace`\n instance, such as photos and reviews, the app must also display the required\n attributions.\n\n For more information, see the documentation on\n [attributions](/maps/documentation/places/ios-sdk/policies#other_attribution_requirements).\n- The response `GMSPlace` instance contains the following member functions:\n\n - [`isOpen`](/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlace#-isopen)\n calculates whether a place is open at the given time.\n\n - [`isOpenAtDate`](/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlace#-isopenatdate:)\n calculates whether a place is open on a given date.\n\n These functions are only available when you enable\n **Places SDK for iOS** . They are not available when you\n enable **Places SDK for iOS (New)** . For more information,\n see [Choose your SDK version](/maps/documentation/places/ios-sdk/choose-sdk).\n\nExample request\n---------------\n\nWith Place Details (New), you make a request and\npass all parameters in the `GMSFetchPlaceRequest` instance. This\nexample also uses a field mask so the response only includes the display name\nand website URL for the place: \n\n### Swift\n\n```swift\n// A hotel in Saigon with an attribution.\nlet placeID = \"ChIJV4k8_9UodTERU5KXbkYpSYs\"\n\n// Specify the place data types to return.\nlet fields = [GMSPlaceProperty.name, GMSPlaceProperty.website].map {$0.rawValue}\n\n// Create the GMSFetchPlaceRequest instance.\nlet fetchPlaceRequest = GMSFetchPlaceRequest(placeID: placeID, placeProperties: fields, sessionToken: nil)\n\nclient.fetchPlaceWithRequest(fetchPlaceRequest: fetchPlaceRequest, callback: {\n (place: GMSPlace?, error: Error?) in\n guard let place, error == nil else { return }\n print(\"Place found: \\(String(describing: place.name))\")\n})\n```\n\n### Objective-C\n\n```objective-c\n// A hotel in Saigon with an attribution.\nNSString *placeID = @\"ChIJV4k8_9UodTERU5KXbkYpSYs\";\n\n// Specify the place data types to return.\nNSArray\u003cNSString *\u003e *fields = @[GMSPlacePropertyName, GMSPlacePropertyWebsite];\n\n// Create the GMSFetchPlaceRequest instance.\nGMSFetchPlaceRequest *fetchPlaceRequest = [[GMSFetchPlaceRequest alloc] initWithPlaceID:placeID placeProperties: fields sessionToken:nil];\n\n[placesClient fetchPlaceWithRequest: fetchPlaceRequest callback: ^(GMSPlace *_Nullable place, NSError *_Nullable error) {\n if (error != nil) {\n NSLog(@\"An error occurred %@\", [error localizedDescription]);\n return;\n } else {\n NSLog(@\"Place Found: %@\", place.name);\n NSLog(@\"The place URL: %@\", place.website);\n }\n}];\n```"]]